diff --git a/pytest_mock.py b/pytest_mock.py index 34ae2a0..cadcc50 100644 --- a/pytest_mock.py +++ b/pytest_mock.py @@ -20,6 +20,7 @@ class MockFixture(object): Mock = mock_module.Mock MagicMock = mock_module.MagicMock PropertyMock = mock_module.PropertyMock + call = mock_module.call ANY = mock_module.ANY def __init__(self): diff --git a/test_pytest_mock.py b/test_pytest_mock.py index d64c0eb..ae09e56 100644 --- a/test_pytest_mock.py +++ b/test_pytest_mock.py @@ -489,3 +489,16 @@ def request(cls, method, args): m = mocker.patch.object(Request, 'request') Request.request(method='get', args={'type': 'application/json'}) m.assert_called_once_with(method='get', args={'type': 'application/json'}) + + +def deep_thought(*someargs): + """Just a mocking target.""" + + +def test_assert_has_calls_with_mocker_call(mocker): + mocked = mocker.patch(__name__ + '.deep_thought', return_value=42) + mocked(mocked("question", "about the universe & stuff")) + mocked.assert_has_calls([ + mocker.call("question", "about the universe & stuff"), + mocker.call(42), + ])