Esempio n. 1
0
 def test_simulate_until_with_rollback():
     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")
     action2_name = action2.get_name("action")
     action2_rollback_name = action2.get_name("rollback")
     ap.simulate_until([(action1_name, {}), (action2_name, {}),
                        (action2_rollback_name, {})])
     ap.undo()
     assert shared_result.result == "c"
Esempio n. 2
0
 def test_simulate_until_error_undo():
     ap = ActionsPipeline()
     shared_result = SharedResultAction()
     action1 = Action(shared_result.gen_action("a"),
                      shared_result.gen_action("c"))
     ap.append(action1)
     action1_name = action1.get_name("action")
     with pytest.raises(ActionException):
         ap.simulate_until([(action1_name, {}), ("garbage", {})])