Skip to content

Instantly share code, notes, and snippets.

@brunomichetti
Created July 1, 2022 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunomichetti/5237e9ab11feb60ec2267876cbf523b9 to your computer and use it in GitHub Desktop.
Save brunomichetti/5237e9ab11feb60ec2267876cbf523b9 to your computer and use it in GitHub Desktop.
# your test file
from django.test import TestCase
# class to define a test case for login
class UserLoginTestCase(TestCase):
...
# some setup here, explained later
def test_correct_login(self):
# unit test
# Corroborate the expected scenario
...
def test_if_password_incorrect_then_cant_login(self):
# unit test
# Corroborate that user's password needs to be only the correct one
...
def test_if_user_not_registered_cant_login(self):
# unit test
# Corroborate that user's are able to login only if they're registered
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment