Esempio n. 1
0
    def test_soap11_fault_handling(self):
        stub = soap.Stub(location="empty")
        stub.SERVICE = soap.Service(name=None,
                                    targetNamespace=None,
                                    location="mock_location",
                                    schema=None,
                                    version=soap.SOAPVersion.SOAP11,
                                    methods=[])

        e = assert_raises(
            core.SOAPError,
            lambda: stub._handle_response(None, None, SOAP11_ERROR_MESSAGE))
        assert_equals('Result', e.code)
        assert_none(e.message)
        assert_equals('Resultset empty2.', e.actor)
Esempio n. 2
0
    def test_soap12_fault_handling(self):
        stub = soap.Stub(location="empty")
        stub.SERVICE = soap.Service(name=None,
                                    targetNamespace=None,
                                    location="mock_location",
                                    schema=None,
                                    version=soap.SOAPVersion.SOAP12,
                                    methods=[])

        e = assert_raises(
            core.SOAPError,
            lambda: stub._handle_response(None, None, SOAP12_ERROR_ROLE))
        assert_equals('env:Sender', e.code)
        assert_equals('\nMessage does not have necessary info\n', e.message)
        assert_equals('http://gizmos.com/order', e.actor)
Esempio n. 3
0
    def test_soap11_fault_handling(self):
        service = soap.Service(
            location='mock_location',
            methods=[],
            name=None,
            schemas=[],
            targetNamespace=None,
            version=soap.SOAPVersion.SOAP11,
        )
        stub = soap.Stub(location='empty', service=service)

        with self.assertRaises(core.SOAPError) as cm:
            stub._handle_response(None, None, SOAP11_ERROR_MESSAGE)
        self.assertEqual('Result', cm.exception.code)
        self.assertIsNone(cm.exception.message)
        self.assertEqual('Resultset empty2.', cm.exception.actor)
Esempio n. 4
0
    def test_soap12_fault_handling(self):
        service = soap.Service(
            location='mock_location',
            methods=[],
            name=None,
            schemas=[],
            targetNamespace=None,
            version=soap.SOAPVersion.SOAP12,
        )
        stub = soap.Stub(location='empty', service=service)

        with self.assertRaises(core.SOAPError) as cm:
            stub._handle_response(None, None, SOAP12_ERROR_ROLE)
        self.assertEqual('env:Sender', cm.exception.code)
        self.assertEqual('\nMessage does not have necessary info\n',
                         cm.exception.message)
        self.assertEqual('http://gizmos.com/order', cm.exception.actor)