Example #1
0
 def test_pushing_context(self):
     x = MockExecutor(
         mocks2handlers([
             AZDFMock(dfactions.ActionType.CALL_ACTIVITY, "Hello",
                      lambda name: f"Hello {name}!")
         ]))
     r = x.execute(orchestrator_function)
Example #2
0
 def test_mocking__change_any_strategy(self):
     x = MockExecutor(
         mocks2handlers([
             AZDFMock(dfactions.ActionType.CALL_ACTIVITY, "Hello",
                      lambda name: f"Hello {name}!")
         ]),
         lambda l: l.children[2],
     )
     r = x.execute(orchestrator_function)
     assert r["taskany"] == "Hello any2!"
Example #3
0
 def test_mocking__reads_args(self):
     x = MockExecutor(
         mocks2handlers([
             AZDFMock(dfactions.ActionType.CALL_ACTIVITY, "Hello",
                      lambda name: f"Hello {name}!")
         ]))
     r = x.execute(orchestrator_function)
     assert r["atomic0"] == "Hello atomic0!"
     assert r["atomic1"] == "Hello atomic1!"
     assert r["taskall"] == ["Hello all0!", "Hello all1!", "Hello all2!"]
     assert r["taskany"] in {"Hello any0!", "Hello any1!", "Hello any2!"}
Example #4
0
 def test_mocking__works(self):
     x = MockExecutor(
         mocks2handlers([
             AZDFMock(dfactions.ActionType.CALL_ACTIVITY, "Hello",
                      lambda _: f"exec")
         ]))
     r = x.execute(orchestrator_function)
     assert r["atomic0"] == "exec"
     assert r["atomic1"] == "exec"
     assert r["taskall"] == ["exec", "exec", "exec"]
     assert r["taskany"] == "exec"