source: TI12-security/trunk/python/ndg.security.test/ndg/security/test/unit/soap/test_soap.py @ 5516

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.test/ndg/security/test/unit/soap/test_soap.py@5516
Revision 5516, 1.1 KB checked in by pjkersha, 11 years ago (diff)

Started work on SAML Attribute Interface SOAP Binding

  • added new ndg.security.common.soap module for ElementTree based SOAP handling. This will allow easy integration with ElementTree based SAML implementation.
Line 
1"""SOAP module unit test module
2
3NERC DataGrid Project
4"""
5__author__ = "P J Kershaw"
6__date__ = "24/07/09"
7__copyright__ = "(C) 2009 Science and Technology Facilities Council"
8__contact__ = "Philip.Kershaw@stfc.ac.uk"
9__license__ = "BSD - see LICENSE file in top-level directory"
10__contact__ = "Philip.Kershaw@stfc.ac.uk"
11__revision__ = "$Id$"
12import logging
13logging.basicConfig(level=logging.DEBUG)
14
15import unittest
16from cStringIO import StringIO
17
18from ndg.security.common.soap import SOAPEnvelope
19
20class SOAPTestCase(unittest.TestCase):
21    def test01Envelope(self):
22        envelope = SOAPEnvelope()
23        envelope.create()
24        soap = envelope.serialize()
25       
26        self.assert_(len(soap) > 0)
27        self.assert_("Envelope" in soap)
28        self.assert_("Body" in soap)
29        self.assert_("SOAP-ENV:Header" in soap)
30       
31        print(envelope.prettyPrint())
32        stream = StringIO()
33        stream.write(soap)
34        stream.seek(0)
35       
36        envelope2 = SOAPEnvelope()
37        envelope2.parse(stream)
38        soap2 = envelope2.serialize()
39        self.assert_(soap2 == soap)
40   
41if __name__ == "__main__":
42    unittest.main()
Note: See TracBrowser for help on using the repository browser.