Ignore:
Timestamp:
04/08/09 12:56:47 (11 years ago)
Author:
pjkersha
Message:
  • Started adding ElementTree based parsers for SAML classes in ndg.security.common.saml.xml.etree.
  • ndg.security.common.utils.prettyPrint needs a bug fix for namespace declarations
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/unit/saml/test_saml.py

    r5538 r5554  
    1919 
    2020from xml.etree.ElementTree import iselement 
     21from xml.etree import ElementTree 
    2122 
    2223from ndg.security.common.saml import Assertion, Attribute, AttributeValue, \ 
     
    240241                        "https://openid.localhost/philip.kershaw") 
    241242         
    242         attributeQueryETreeObject = AttributeQueryETreeObject() 
    243         attributeQueryETreeObject.create(attributeQuery) 
    244         xmlOutput = attributeQueryETreeObject.prettyPrint() 
     243        elem = AttributeQueryETreeObject.create(attributeQuery) 
     244        xmlOutput = AttributeQueryETreeObject.prettyPrint(elem) 
    245245        print(xmlOutput) 
    246246 
     
    254254                        "https://openid.localhost/philip.kershaw") 
    255255         
    256         attributeQueryETreeObject = AttributeQueryETreeObject() 
    257         attributeQueryETreeObject.create(attributeQuery) 
    258         xmlOutput = attributeQueryETreeObject.prettyPrint() 
    259          
    260         attributeQueryETreeObject2 = AttributeQueryETreeObject() 
     256        elem = AttributeQueryETreeObject.create(attributeQuery) 
     257#        xmlOutput = AttributeQueryETreeObject.prettyPrint(elem) 
     258        xmlOutput = AttributeQueryETreeObject.serialize(elem) 
    261259         
    262260        attributeQueryStream = StringIO() 
    263261        attributeQueryStream.write(xmlOutput) 
    264262        attributeQueryStream.seek(0) 
    265          
    266         attributeQuery2=attributeQueryETreeObject2.parse(attributeQueryStream) 
    267         xmlOutput2 = attributeQuery2.serialize() 
     263        print ElementTree.tostring(elem) 
     264        tree = ElementTree.parse(attributeQueryStream) 
     265        elem2 = tree.getroot() 
     266         
     267        attributeQuery2 = AttributeQueryETreeObject.parse(elem2) 
     268        xmlOutput2 = AttributeQueryETreeObject.serialize(elem2) 
    268269        self.assert_(xmlOutput == xmlOutput2) 
    269270         
Note: See TracChangeset for help on using the changeset viewer.