aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_script.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_script.py')
-rw-r--r--test/test_script.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/test_script.py b/test/test_script.py
index 025e9f37..13903066 100644
--- a/test/test_script.py
+++ b/test/test_script.py
@@ -32,8 +32,8 @@ class TestScript:
r = tutils.treq()
fm.handle_request(r)
assert fm.state.flow_count() == 2
- assert not fm.state.view[0].request.is_replay()
- assert fm.state.view[1].request.is_replay()
+ assert not fm.state.view[0].request.is_replay
+ assert fm.state.view[1].request.is_replay
def test_err(self):
s = flow.State()
@@ -75,9 +75,6 @@ class TestScript:
# Two instantiations
assert m.call_count == 2
assert (time.time() - t_start) < 0.09
- time.sleep(0.2)
- # Plus two invocations
- assert m.call_count == 4
def test_concurrent2(self):
s = flow.State()
@@ -89,13 +86,17 @@ class TestScript:
f.reply = f.request.reply
with mock.patch("libmproxy.controller.DummyReply.__call__") as m:
+ t_start = time.time()
s.run("clientconnect", f)
s.run("serverconnect", f)
s.run("response", f)
s.run("error", f)
s.run("clientdisconnect", f)
- time.sleep(0.1)
- assert m.call_count == 5
+ while (time.time() - t_start) < 1 and m.call_count <= 5:
+ if m.call_count == 5:
+ return
+ time.sleep(0.001)
+ assert False
def test_concurrent_err(self):
s = flow.State()