def test_verify_has_calls__ordered_has(self): x = MockExecutor.lax() r = x.execute(orchestrator_function) x.assert_has_calls([ dfactions.CallActivityAction("Hello", input_="atomic0"), dfactions.CallActivityAction("Hello", input_="atomic1"), ])
def test_verify_has_calls__unordered_out_of_order(self): x = MockExecutor.lax() r = x.execute(orchestrator_function) calls = [ dfactions.CallActivityAction("Hello", input_="atomic1"), dfactions.CallActivityAction("Hello", input_="atomic0"), ] x.assert_has_calls(calls, any_order=True)
def test_verify_has_calls__unordered_not_matched(self): x = MockExecutor.lax() r = x.execute(orchestrator_function) calls = [ dfactions.CallActivityAction("Hello", input_="notfound"), dfactions.CallActivityAction("Hello", input_="atomic1"), ] with pytest.raises(AssertionError) as e: x.assert_has_calls(calls)
def test_verify_has_calls__ordered_out_of_order(self): x = MockExecutor.lax() r = x.execute(orchestrator_function) calls = [ dfactions.CallActivityAction("Hello", input_="atomic1"), dfactions.CallActivityAction("Hello", input_="atomic0"), ] with pytest.raises(AssertionError) as e: x.assert_has_calls(calls) # assert returns unmatched calls assert e.value.args[1] == [calls[1]]
def test_verify_any_call__not_called(self): x = MockExecutor.lax() r = x.execute(orchestrator_function) with pytest.raises(AssertionError): x.assert_any_call( dfactions.CallActivityAction("Hello", input_="bad args"))
def test_verify_called_once_with__called_more_than_once(self): x = MockExecutor.lax() r = x.execute(orchestrator_function) with pytest.raises(AssertionError): x.assert_called_once_with( dfactions.CallActivityAction("Hello", input_="called_once"))
def test_verify_called_once_with__called_wrong_arguments(self): x = MockExecutor.lax() r = x.execute(self.called_once_orchestrator) with pytest.raises(AssertionError): x.assert_called_once_with( dfactions.CallActivityAction("Hello", input_="wrong_args"))
def test_verify_called_with__not_last(self): x = MockExecutor.lax() r = x.execute(orchestrator_function) with pytest.raises(AssertionError): x.assert_called_once_with( dfactions.CallActivityAction("NotLast", input_="called_once"))
def test_verify_any_call__nested(self): """Test for when the call is nested inside of a WhenAnyTask or a WhenAllTask""" x = MockExecutor.lax() r = x.execute(orchestrator_function) x.assert_any_call(dfactions.CallActivityAction("Hello", input_="all0"))
def test_verify_any_call__called(self): x = MockExecutor.lax() r = x.execute(orchestrator_function) x.assert_any_call( dfactions.CallActivityAction("Hello", input_="atomic0"))
def test_verify_called_once_with__called(self): x = MockExecutor.lax() r = x.execute(self.called_once_orchestrator) x.assert_called_once_with( dfactions.CallActivityAction("Hello", input_="called_once"))