Skip to content

Instantly share code, notes, and snippets.

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