Skip to content

Instantly share code, notes, and snippets.

@stevemer
Last active July 7, 2019 05:44
Show Gist options
  • Save stevemer/83aa68bdbe04a63ae0ccb4c7d2e76e7a to your computer and use it in GitHub Desktop.
Save stevemer/83aa68bdbe04a63ae0ccb4c7d2e76e7a to your computer and use it in GitHub Desktop.
A beautiful, elegant test case.
class MyTestCase(unittest.TestCase):
testFoo_ShouldUpdateBarService_ForUserWithExistingBaz(self):
# foo calls the Garble service internally, so we mock the response.
supposeGarbleServiceReturns(EXPECTED_GARBLE_RESPONSE);
user = makeSimpleUserWithExistingBaz();
foo(user);
# Ensure Bar was updated to contain the recent user.
self.assertIn(user.id, (u.id for u in bar_service.recentUsers()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment