Skip to content

Instantly share code, notes, and snippets.

@mattjmorrison
Created February 20, 2011 05:33
Show Gist options
  • Save mattjmorrison/835739 to your computer and use it in GitHub Desktop.
Save mattjmorrison/835739 to your computer and use it in GitHub Desktop.
Simple django mocking test example 3
@mock.patch('django_testing.models.SampleManager.filter')
def test_filters_by_user_with_patch_and_filter_passed_in(self, filter_method):
user = mock.Mock()
models.Sample.objects.get_by_user(user)
filter_method.assert_called_with(user=user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment