Beispiel #1
0
    def test__get_ssl_context(self):

        stream = Stream('127.0.0.1', port=8080)

        # we actually still have an http connection here, but we're faking https
        # to test the expected proxy behaviour
        stream._ssl_enabled = True

        # if ssl verification is enabled (default), context=None expected
        context = stream._get_ssl_context()
        self.assertIsNone(context)

        # if ssl verification is disabled, SSLContext expected
        stream._ssl_verification_enabled = False
        context = stream._get_ssl_context()
        self.assertIsInstance(context, ssl.SSLContext)
Beispiel #2
0
    def test__get_ssl_context(self):

        stream = Stream('127.0.0.1', port=8080)

        # we actually still have an http connection here, but we're faking https
        # to test the expected proxy behaviour
        stream._ssl_enabled = True

        # if ssl verification is enabled (default), context=None expected
        context = stream._get_ssl_context()
        self.assertIsNone(context)

        # if ssl verification is disabled, SSLContext expected
        stream._ssl_verification_enabled = False
        context = stream._get_ssl_context()
        self.assertIsInstance(context, ssl.SSLContext)