Exemple #1
0
 def test_simulate_until_error():
     ap = ActionsPipeline()
     shared_result = SharedResultAction()
     action1 = Action(shared_result.gen_action("a"),
                      shared_result.gen_action("c"))
     ap.append(action1)
     with pytest.raises(ActionException):
         ap.simulate_until([("garbage", {})])
Exemple #2
0
 def test_simulate_until():
     ap = ActionsPipeline()
     shared_result = SharedResultAction()
     action1 = Action(shared_result.gen_action("a"),
                      shared_result.gen_action("c"))
     action2 = Action(shared_result.gen_action("b"),
                      shared_result.gen_action("d"))
     ap.append(action1)
     ap.append(action2)
     action1_name = action1.get_name("action")
     ap.simulate_until([(action1_name, {})])
     ap.do()
     ap.undo()
     assert shared_result.result == "bdc"
Exemple #3
0
 def test_simulate_until_partial():
     ap = ActionsPipeline()
     shared_result = SharedResultAction()
     action1 = Action(shared_result.gen_action("a"),
                      shared_result.gen_action("c"))
     action2 = Action(shared_result.gen_action("b"),
                      shared_result.gen_action("d"))
     ap.append(action1)
     ap.append(action2)
     # Mandatory to redefine names unless they all have the same name and simulate can't work fine.
     action1.set_name("action", "action1")
     action1.set_name("rollback", "rollback1")
     ap.simulate_until([("action1", {}), ("rollback1", {})])
     ap.undo()
     assert shared_result.result == ""