Esempio n. 1
0
 def test_get_http_connection(self):
     sqs = Mock(name='sqs')
     x = AsyncConnection(sqs)
     assert isinstance(
         x.get_http_connection(),
         AsyncHTTPSConnection,
     )
     conn = x.get_http_connection()
     assert conn.http_client is x._httpclient
Esempio n. 2
0
    def test_get_http_connection(self):
        x = AsyncConnection(client=Mock(name='client'))
        self.assertIsInstance(
            x.get_http_connection('aws.vandelay.com', 80, False),
            AsyncHTTPConnection,
        )
        self.assertIsInstance(
            x.get_http_connection('aws.vandelay.com', 443, True),
            AsyncHTTPSConnection,
        )

        conn = x.get_http_connection('aws.vandelay.com', 80, False)
        self.assertIs(conn.http_client, x._httpclient)
        self.assertEqual(conn.host, 'aws.vandelay.com')
        self.assertEqual(conn.port, 80)
Esempio n. 3
0
    def test_get_http_connection(self):
        x = AsyncConnection(client=Mock(name='client'))
        self.assertIsInstance(
            x.get_http_connection('aws.vandelay.com', 80, False),
            AsyncHTTPConnection,
        )
        self.assertIsInstance(
            x.get_http_connection('aws.vandelay.com', 443, True),
            AsyncHTTPSConnection,
        )

        conn = x.get_http_connection('aws.vandelay.com', 80, False)
        self.assertIs(conn.http_client, x._httpclient)
        self.assertEqual(conn.host, 'aws.vandelay.com')
        self.assertEqual(conn.port, 80)
Esempio n. 4
0
    def test_get_http_connection(self):
        x = AsyncConnection(client=Mock(name='client'))
        assert isinstance(
            x.get_http_connection('aws.vandelay.com', 80, False),
            AsyncHTTPConnection,
        )
        assert isinstance(
            x.get_http_connection('aws.vandelay.com', 443, True),
            AsyncHTTPSConnection,
        )

        conn = x.get_http_connection('aws.vandelay.com', 80, False)
        assert conn.http_client is x._httpclient
        assert conn.host == 'aws.vandelay.com'
        assert conn.port == 80