reenabled admin area; outfitted apps.lyric.models w. AbstractBaseUser instead of custom user class; many other fns & several models updated to accomodate, such as set_unusable_password() method to base user model; reset staging db to prepare for refreshed lyric migrations to accomodate for retrofitted pw field
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -2,6 +2,7 @@ from django.http import HttpRequest
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from apps.lyric.authentication import PasswordlessAuthenticationBackend
|
||||
from apps.lyric.models import User
|
||||
|
||||
|
||||
class SimpleAuthenticateTest(SimpleTestCase):
|
||||
@@ -15,3 +16,16 @@ class SimpleAuthenticateTest(SimpleTestCase):
|
||||
result = PasswordlessAuthenticationBackend().authenticate(HttpRequest())
|
||||
self.assertIsNone(result)
|
||||
|
||||
class UserPermissionsTest(SimpleTestCase):
|
||||
def test_superuser_has_perm(self):
|
||||
user = User(is_superuser=True)
|
||||
self.assertTrue(user.has_perm("any.permission"))
|
||||
|
||||
def test_superuser_has_module_perms(self):
|
||||
user = User(is_superuser=True)
|
||||
self.assertTrue(user.has_module_perms("any_app"))
|
||||
|
||||
def test_non_superuser_has_no_perm(self):
|
||||
user = User(is_superuser=False)
|
||||
self.assertFalse(user.has_perm("any.permission"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user