0
|
1 |
#
|
|
2 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
# All rights reserved.
|
|
4 |
# This component and the accompanying materials are made available
|
|
5 |
# under the terms of "Eclipse Public License v1.0"
|
|
6 |
# which accompanies this distribution, and is available
|
|
7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
#
|
|
9 |
# Initial Contributors:
|
|
10 |
# Nokia Corporation - initial contribution.
|
|
11 |
#
|
|
12 |
# Contributors:
|
|
13 |
#
|
|
14 |
# Description:
|
|
15 |
#
|
|
16 |
|
3
|
17 |
import unittest, os, sys
|
0
|
18 |
|
|
19 |
from genconfmlplugin import xslttransformer
|
|
20 |
|
|
21 |
# Hardcoded value of testdata folder that must be under the current working dir
|
|
22 |
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
|
|
23 |
testdata = os.path.join(ROOT_PATH,'project')
|
3
|
24 |
expected = u'<html><body>\r\n<h2>My CD Collection</h2>\r\n<table border="1">\r\n<tr bgcolor="#9acd32">\r\n<th>Title</th>\r\n<th>Artist</th>\r\n</tr>\r\n<tr>\r\n<td>.</td>\r\n<td>.</td>\r\n</tr>\r\n</table>\r\n</body></html>\r\n\r\n'.replace('\r\n', os.linesep)
|
0
|
25 |
|
3
|
26 |
|
|
27 |
class TestXstlTransformer(unittest.TestCase):
|
0
|
28 |
def setUp(self):
|
|
29 |
self.curdir = os.getcwd()
|
|
30 |
self.output = 'output'
|
|
31 |
pass
|
|
32 |
|
|
33 |
def tearDown(self):
|
|
34 |
pass
|
|
35 |
|
|
36 |
def test_transform(self):
|
|
37 |
'''
|
|
38 |
Test that the xslt transformation works
|
|
39 |
'''
|
|
40 |
transformer = xslttransformer.XsltTransformer()
|
3
|
41 |
result = transformer.transform_lxml(os.path.join(ROOT_PATH,"xslt/cdcatalog.xml"),
|
|
42 |
os.path.join(ROOT_PATH,"xslt/cdcatalog_ex1.xsl"),
|
0
|
43 |
sys.getdefaultencoding())
|
3
|
44 |
self.assertEquals(result, expected)
|
0
|
45 |
|
|
46 |
|
|
47 |
if __name__ == '__main__':
|
3
|
48 |
unittest.main()
|