Last active
December 5, 2021 18:36
-
-
Save dmukhg/638680997c5165a0f622fd91dd0dddf0 to your computer and use it in GitHub Desktop.
Writing services that are testable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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