Ejemplo n.º 1
0
    def test_bad_request_full_response(self):
        address = ('127.0.0.1', 9099)
        client = Echo(full_response=True)

        def _test_bad_request():
            # Run on client event loop so we test for the existing connection
            result = client.request(address, b'Hello!')
            self.assertTrue(result.connection)
            try:
                yield result.on_finished
            except socket.error as e:
                pass
            self.assertFalse(result.connection.transport)
            self.assertEqual(len(client.connection_pools), 1)

        client.get_event_loop().call_soon(_test_bad_request)
Ejemplo n.º 2
0
    def test_bad_request_full_response(self):
        address = ('127.0.0.1', 9099)
        client = Echo(full_response=True)

        def _test_bad_request():
            # Run on client event loop so we test for the existing connection
            result = client.request(address, b'Hello!')
            self.assertTrue(result.connection)
            try:
                yield result.on_finished
            except socket.error as e:
                pass
            self.assertFalse(result.connection.transport)
            self.assertEqual(len(client.connection_pools), 1)

        client.get_event_loop().call_soon(_test_bad_request)
Ejemplo n.º 3
0
 def test_has_event_loop(self):
     loop = get_event_loop()
     client = Echo(event_loop=loop)
     self.assertTrue(client.event_loop)
     self.assertEqual(client.event_loop, loop)
     self.assertEqual(client.get_event_loop(), loop)
Ejemplo n.º 4
0
 def test_event_loop(self):
     client = Echo()
     self.assertFalse(client.event_loop)
     self.assertTrue(client.get_event_loop())
     self.assertEqual(client.get_event_loop(), get_event_loop())
Ejemplo n.º 5
0
 def test_has_event_loop(self):
     loop = get_event_loop()
     client = Echo(event_loop=loop)
     self.assertTrue(client.event_loop)
     self.assertEqual(client.event_loop, loop)
     self.assertEqual(client.get_event_loop(), loop)
Ejemplo n.º 6
0
 def test_event_loop(self):
     client = Echo()
     self.assertFalse(client.event_loop)
     self.assertTrue(client.get_event_loop())
     self.assertEqual(client.get_event_loop(), get_event_loop())