Skip to content

Instantly share code, notes, and snippets.

@dmukhg
Last active December 5, 2021 18:36
Show Gist options
  • Save dmukhg/638680997c5165a0f622fd91dd0dddf0 to your computer and use it in GitHub Desktop.
Save dmukhg/638680997c5165a0f622fd91dd0dddf0 to your computer and use it in GitHub Desktop.
Writing services that are testable
from .auth import AccessControlList
acl = AccessControlList()
class BadBookService(object):
def create_book(self, user, book):
if acl.can_create_book(user):
# ... code to create book
else:
# ... raise an exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment