Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 'mocker.call' convenience name (closes #48) #49

Merged
merged 1 commit into from
Jun 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pytest_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
13 changes: 13 additions & 0 deletions test_pytest_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
])