示例#1
0
    def test_plain_http_no_args_fails(self):
        """The default behaviour should be to refuse to send credentials over HTTP"""
        transport = HTTPSTransport()
        transport.session = self.mocked_session

        with self.assertRaises((SSLError, TransportError)):
            transport.open(make_request('http://example.com/'))
示例#2
0
    def test_plain_http_rewrite_rewritten(self):
        transport = HTTPSTransport(rewrite_to_https=True)
        transport.session = self.mocked_session
        return_value = mock.MagicMock()
        return_value.content = b''
        transport.session.get.return_value = return_value

        transport.open(make_request('http://example.com'))
        # mock.MagicMock.assert_called_with does not allow specifying interest in a single argument
        self.assertEqual(
            transport.session.get.call_args[1].get('url'),
            'https://example.com'
        )
示例#3
0
    def test_plain_http_no_rewrite_fails(self):
        """
        Some buggy SOAP servers reference plain HTTP urls in the WSDL
        even when served over HTTPS.
        The ``SudsClientStrictSSL`` Transport has an option to rewrite urls to HTTPS
        before making the request.  If this is `False`, and `verify_ssl == True`
        We expect the request to fail.
        Assert that the default behaviour of the transport is strict.
        Does not allow plain HTTP unless overriden with verify_ssl=False"""
        transport = HTTPSTransport(rewrite_to_https=False)
        transport.session = self.mocked_session

        with self.assertRaises((SSLError, TransportError)):
            transport.open(make_request('http://example.com/'))