Beispiel #1
0
 def test_unwrap_soap_envelope_header(self):
     """
     `unwrap_soap_envelope` unwraps a SOAP envelope element, with a header,
     to a tuple of the SOAP body and header elements.
     """
     body, header = unwrap_soap_envelope(
         soap_envelope(Element('tag', 'hello'), Element('header', 'value')))
     self.assertEqual(
         '<soapenv:Header xmlns:soapenv='
         '"http://schemas.xmlsoap.org/soap/envelope/">'
         '<header>value</header></soapenv:Header>', tostring(header))
     self.assertEqual(
         '<soapenv:Body xmlns:soapenv='
         '"http://schemas.xmlsoap.org/soap/envelope/">'
         '<tag>hello</tag></soapenv:Body>', tostring(body))
Beispiel #2
0
 def test_unwrap_soap_envelope(self):
     """
     `unwrap_soap_envelope` unwraps a SOAP envelope element, with no header,
     to a tuple of the SOAP body element and ``None``.
     """
     body, header = unwrap_soap_envelope(
         soap_envelope(Element('tag', 'hello')))
     self.assertIdentical(None, header)
     self.assertEqual(
         '<soapenv:Body xmlns:soapenv='
         '"http://schemas.xmlsoap.org/soap/envelope/"><tag>hello</tag>'
         '</soapenv:Body>', tostring(body))
Beispiel #3
0
 def test_soap_envelope(self):
     """
     `soap_envelope` wraps content in a SOAP envelope element.
     """
     self.assertEqual(
         '<soapenv:Envelope xmlns:soapenv='
         '"http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>'
         'hello</soapenv:Body></soapenv:Envelope>',
         tostring(soap_envelope('hello')))
     self.assertEqual(
         '<soapenv:Envelope xmlns:soapenv='
         '"http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>'
         '<tag>hello</tag></soapenv:Body></soapenv:Envelope>',
         tostring(soap_envelope(Element('tag', 'hello'))))
Beispiel #4
0
 def test_missing_fault(self):
     """
     `SoapFault.from_element` raises `ValueError` if the element contains no
     SOAP fault.
     """
     self.assertRaises(ValueError, SoapFault.from_element, Element('tag'))