def test_request_done_after_start(server): server = TestServer(port=10000) server.start() try: assert server.request['done'] is False finally: server.stop()
def server_process(wait_event, server_queue): test_server = TestServer(address=config.TEST_SERVER_HOST_IP, port=config.TEST_SERVER_EXTRA_PORT) test_server.start() test_server.response['data'] = b'zzz' wait_event.wait() server_queue.put(test_server.request) test_server.stop()
def test_multiple_start_stop_cycles(self): for x in range(30): server = TestServer() server.start() server.response["data"] = b"zorro" for y in range(10): data = urlopen(server.get_url()).read() self.assertEqual(data, server.response["data"]) server.stop()
def test_multiple_start_stop_cycles(): start_port = 10100 for cnt in range(30): server2 = TestServer(port=start_port + cnt) server2.start() try: server2.response['data'] = b'zorro' for _ in range(10): data = urlopen(server2.get_url()).read() assert data == b'zorro' finally: server2.stop()