diff options
Diffstat (limited to 'test/test_flow.py')
-rw-r--r-- | test/test_flow.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/test/test_flow.py b/test/test_flow.py index bf6a7a42..f9198f0c 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -563,12 +563,11 @@ class TestFlowMaster: def test_load_script(self): s = flow.State() fm = flow.FlowMaster(None, s) - assert not fm.load_script([tutils.test_data.path("scripts/a.py")]) - assert not fm.load_script([tutils.test_data.path("scripts/a.py")]) - assert not fm.unload_script(fm.scripts[0]) - assert not fm.unload_script(fm.scripts[0]) - assert fm.load_script(["nonexistent"]) - assert "ValueError" in fm.load_script([tutils.test_data.path("scripts/starterr.py")]) + assert not fm.load_script(tutils.test_data.path("scripts/a.py")) + assert not fm.load_script(tutils.test_data.path("scripts/a.py")) + assert not fm.unload_scripts() + assert fm.load_script("nonexistent") + assert "ValueError" in fm.load_script(tutils.test_data.path("scripts/starterr.py")) assert len(fm.scripts) == 0 def test_replay(self): @@ -584,7 +583,7 @@ class TestFlowMaster: def test_script_reqerr(self): s = flow.State() fm = flow.FlowMaster(None, s) - assert not fm.load_script([tutils.test_data.path("scripts/reqerr.py")]) + assert not fm.load_script(tutils.test_data.path("scripts/reqerr.py")) req = tutils.treq() fm.handle_clientconnect(req.client_conn) assert fm.handle_request(req) @@ -592,7 +591,7 @@ class TestFlowMaster: def test_script(self): s = flow.State() fm = flow.FlowMaster(None, s) - assert not fm.load_script([tutils.test_data.path("scripts/all.py")]) + assert not fm.load_script(tutils.test_data.path("scripts/all.py")) req = tutils.treq() fm.handle_clientconnect(req.client_conn) assert fm.scripts[0].ns["log"][-1] == "clientconnect" @@ -606,16 +605,20 @@ class TestFlowMaster: fm.handle_response(resp) assert fm.scripts[0].ns["log"][-1] == "response" #load second script - assert not fm.load_script([tutils.test_data.path("scripts/all.py")]) + assert not fm.load_script(tutils.test_data.path("scripts/all.py")) assert len(fm.scripts) == 2 dc = flow.ClientDisconnect(req.client_conn) dc.reply = controller.DummyReply() fm.handle_clientdisconnect(dc) assert fm.scripts[0].ns["log"][-1] == "clientdisconnect" assert fm.scripts[1].ns["log"][-1] == "clientdisconnect" + + #unload first script - fm.unload_script(fm.scripts[0]) - assert len(fm.scripts) == 1 + fm.unload_scripts() + assert len(fm.scripts) == 0 + + assert not fm.load_script(tutils.test_data.path("scripts/all.py")) err = flow.Error(f.request, "msg") err.reply = controller.DummyReply() fm.handle_error(err) @@ -659,7 +662,7 @@ class TestFlowMaster: err.reply = controller.DummyReply() fm.handle_error(err) - fm.load_script([tutils.test_data.path("scripts/a.py")]) + fm.load_script(tutils.test_data.path("scripts/a.py")) fm.shutdown() def test_client_playback(self): |