Beispiel #1
0
 def test_soap_action(self):
     """Test that SOAP action is passed on to SoapMessage.request()."""
     msg = SoapMessage(etree.Element('test'))
     msg.request = MagicMock()
     with patch('requests.Session'):
         client = SoapClient('http://example.com')
         client(msg, 'testaction', build_response=lambda r: r)
         msg.request.assert_called_once_with('http://example.com',
                                             'testaction')
Beispiel #2
0
 def test_no_soap_action(self):
     """Test that empty SOAP action is passed to SoapMessage.request()
        when no action given."""
     msg = SoapMessage(etree.Element('test'))
     msg.request = MagicMock()
     with patch('requests.Session') as mock:
         client = SoapClient('http://example.com')
         response = client(msg, build_response=lambda r: r)
         msg.request.assert_called_once_with('http://example.com', '')
Beispiel #3
0
 def test_no_soap_action(self):
     """Test that empty SOAP action is passed to SoapMessage.request()
        when no action given."""
     msg = SoapMessage(etree.Element('test'))
     msg.request = MagicMock()
     with patch('requests.Session'):
         client = SoapClient('http://example.com')
         client(msg, build_response=lambda r: r)
         msg.request.assert_called_once_with('http://example.com', '')
Beispiel #4
0
 def test_soap_action_is_none(self):
     """Test that SOAP-Action HTTP header is absent when no action is None.
     """
     msg = SoapMessage(etree.Element('test'))
     req = msg.request('http://example.com', None)
     self.assertTrue('SOAPAction' not in req.headers)
Beispiel #5
0
 def test_soap_action(self):
     """Test that SOAP-Action HTTP header is set correctly."""
     msg = SoapMessage(etree.Element('test'))
     req = msg.request('http://example.com', 'testaction')
     self.assertEqual(req.headers['SOAPAction'], 'testaction')
Beispiel #6
0
 def test_soap_action_is_none(self):
     """Test that SOAP-Action HTTP header is absent when no action is None.
     """
     msg = SoapMessage(etree.Element('test'))
     req = msg.request('http://example.com', None)
     self.assertTrue('SOAPAction' not in req.headers)
Beispiel #7
0
 def test_soap_action(self):
     """Test that SOAP-Action HTTP header is set correctly."""
     msg = SoapMessage(etree.Element('test'))
     req = msg.request('http://example.com', 'testaction')
     self.assertEqual(req.headers['SOAPAction'], 'testaction')