Пример #1
0
 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()
Пример #2
0
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()
Пример #3
0
def test_specific_port():
    server = TestServer(address='localhost', port=9876)
    server.start()
    server.response['data'] = b'abc'
    data = urlopen(server.get_url()).read()
    assert data == b'abc'