587
|
1 |
#============================================================================
|
|
2 |
#Name : test_documentation.py
|
|
3 |
#Part of : Helium
|
|
4 |
|
|
5 |
#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
6 |
#All rights reserved.
|
|
7 |
#This component and the accompanying materials are made available
|
|
8 |
#under the terms of the License "Eclipse Public License v1.0"
|
|
9 |
#which accompanies this distribution, and is available
|
|
10 |
#at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
11 |
#
|
|
12 |
#Initial Contributors:
|
|
13 |
#Nokia Corporation - initial contribution.
|
|
14 |
#
|
|
15 |
#Contributors:
|
|
16 |
#
|
|
17 |
#Description:
|
|
18 |
#===============================================================================
|
588
|
19 |
""" test documentation """
|
587
|
20 |
|
|
21 |
import tempfile
|
|
22 |
import os
|
|
23 |
import logging
|
|
24 |
import unittest
|
|
25 |
import sys
|
|
26 |
from helium.documentation import APIDeltaWriter
|
|
27 |
|
|
28 |
_logger = logging.getLogger('test.documentation')
|
|
29 |
logging.basicConfig(level=logging.INFO)
|
|
30 |
|
|
31 |
class DocumentationTest(unittest.TestCase):
|
|
32 |
""" Unit tests for documentation module """
|
|
33 |
def test_APIDeltaWriter(self):
|
588
|
34 |
"""test API Delta writer"""
|
587
|
35 |
(fileDes, tempFileName) = tempfile.mkstemp()
|
|
36 |
old_db = os.path.join(os.environ['TEST_DATA'], 'data', 'docs', 'sample_old_db.xml')
|
|
37 |
new_db = os.path.join(os.environ['TEST_DATA'], 'data', 'docs', 'sample_new_db.xml')
|
628
|
38 |
writer = APIDeltaWriter(open(old_db), open(new_db))
|
587
|
39 |
saveout = sys.stdout
|
|
40 |
sys.stdout = sys.stderr
|
|
41 |
writer.write(tempFileName)
|
|
42 |
os.close(fileDes)
|
|
43 |
sys.stdout = saveout
|
|
44 |
tempFile = open(tempFileName, 'r')
|
|
45 |
content = tempFile.readlines()
|
|
46 |
tempFile.close()
|
|
47 |
os.unlink(tempFileName)
|
628
|
48 |
assert len(content) == 13
|