configurationengine/source/cone/confml/tests/unittest_confmlxml.py
changeset 0 2e8eeb919028
child 3 e7e0ae78773e
equal deleted inserted replaced
-1:000000000000 0:2e8eeb919028
       
     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 
       
    17 """
       
    18 Test the CPF root file parsing routines
       
    19 """
       
    20 
       
    21 import unittest
       
    22 import string
       
    23 import sys
       
    24 import os
       
    25 import shutil
       
    26 import __init__
       
    27 
       
    28 from cone.public import api, exceptions, persistence
       
    29 from cone.storage import filestorage
       
    30 from cone.confml import persistentconfml, model, confmltree
       
    31 
       
    32 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
       
    33 
       
    34 class TestConfmlXml(unittest.TestCase):
       
    35        
       
    36     def test_namespaces(self):
       
    37         root = confmltree.Element('root')
       
    38         elem = confmltree.Element('{http://spam.effbot.org}egg')
       
    39         root.append(elem)
       
    40         elem.append(confmltree.Element('{http://spam.effbot.org}ham'))
       
    41         elem.append(confmltree.Element('{http://test.com}foo'))
       
    42         str = confmltree.tostring(root, {'http://spam.effbot.org': 'ham',
       
    43                               'http://test.com': 'bar'})
       
    44         et = confmltree.fromstring(str)
       
    45         self.assertTrue(et)
       
    46         self.assertEquals(str,'<root xmlns:bar="http://test.com" xmlns:ham="http://spam.effbot.org"><ham:egg><ham:ham /><bar:foo /></ham:egg></root>')
       
    47 
       
    48 
       
    49 if __name__ == '__main__':
       
    50     unittest.main()