Skip to content

Commit

Permalink
Fixed linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mghaznav committed Jul 11, 2024
1 parent ecfb9d2 commit 5c1248a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

class UserManager(BaseUserManager):

def create_user(self, email, password = None, **extrafields):
def create_user(self, email, password=None, **extrafields):
if not email:
raise ValueError('Email address is required to create a new User.')

user = self.model(email = self.normalize_email(email), **extrafields)
user = self.model(email=self.normalize_email(email), **extrafields)
user.set_password(password)
user.save(using=self._db)

Expand All @@ -27,6 +27,7 @@ def create_superuser(self, email, password):

return superuser


class User(AbstractBaseUser, PermissionsMixin):
email = models.EmailField(max_length=255, unique=True)
name = models.CharField(max_length=255)
Expand Down
9 changes: 5 additions & 4 deletions app/core/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from django.test import TestCase
from django.contrib.auth import get_user_model


class ModelTests(TestCase):

def test_create_user_with_email_successful(self):
email = '[email protected]'
password = 'testpass123'

user = get_user_model().objects.create_user(
email = email,
password = password
email=email,
password=password
)

self.assertEqual(user.email, email)
Expand All @@ -36,8 +37,8 @@ def test_create_superuser(self):
password = 'testpass123'

user = get_user_model().objects.create_superuser(
email = email,
password = password
email=email,
password=password
)

self.assertTrue(user.is_superuser)
Expand Down

0 comments on commit 5c1248a

Please sign in to comment.