mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Speed up the test suite by reducing time sleeping in tests.
This commit is contained in:
parent
7a79eeb143
commit
0f406e9daa
@ -108,21 +108,20 @@ class TestProxy(tutils.HTTPProxTest):
|
|||||||
|
|
||||||
# call pathod server, wait a second to complete the request
|
# call pathod server, wait a second to complete the request
|
||||||
connection.send("GET http://localhost:%d/p/304:b@1k HTTP/1.1\r\n"%self.server.port)
|
connection.send("GET http://localhost:%d/p/304:b@1k HTTP/1.1\r\n"%self.server.port)
|
||||||
time.sleep(2.1)
|
time.sleep(0.1)
|
||||||
connection.send("\r\n");
|
connection.send("\r\n");
|
||||||
connection.recv(50000)
|
connection.recv(50000)
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
request, response = self.master.state.view[0].request, self.master.state.view[0].response
|
request, response = self.master.state.view[0].request, self.master.state.view[0].response
|
||||||
assert response.code == 304 # sanity test for our low level request
|
assert response.code == 304 # sanity test for our low level request
|
||||||
assert 2 <= request.timestamp_end - request.timestamp_start <= 2.2
|
assert 0 <= request.timestamp_end - request.timestamp_start <= 0.2
|
||||||
|
|
||||||
def test_request_timestamps_not_affected_by_client_time(self):
|
def test_request_timestamps_not_affected_by_client_time(self):
|
||||||
# test that don't include user wait time in request's timestamps
|
# test that don't include user wait time in request's timestamps
|
||||||
|
|
||||||
f = self.pathod("304:b@10k")
|
f = self.pathod("304:b@10k")
|
||||||
assert f.status_code == 304
|
assert f.status_code == 304
|
||||||
time.sleep(1)
|
|
||||||
f = self.pathod("304:b@10k")
|
f = self.pathod("304:b@10k")
|
||||||
assert f.status_code == 304
|
assert f.status_code == 304
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user