Fakultas Ilmu Komputer UI

Commit 0554eae0 authored by Jonathan Christopher Jakub's avatar Jonathan Christopher Jakub
Browse files

[RED] Add test for anonymous user authenticated permission

parent 71fa0b74
Pipeline #49741 failed with stages
in 1 minute and 48 seconds
......@@ -19,6 +19,7 @@ class IsAuthenticatedPermissionTest(APITestCase):
cls.user_1 = UserFactory(username="user_1", password="justpass")
cls.user_2 = UserFactory(username="user_2", password="justpass")
cls.user_3 = UserFactory(username="user_3", password="justpass")
cls.user_4 = UserFactory(username="user_4", password="justpass")
cls.account_1 = AccountFactory(
admin=True,
......@@ -32,7 +33,7 @@ class IsAuthenticatedPermissionTest(APITestCase):
is_active=False,
is_verified=True
)
cls.account_2 = AccountFactory(
cls.account_3 = AccountFactory(
admin=False,
user=cls.user_3,
is_active=True,
......@@ -62,6 +63,12 @@ class IsAuthenticatedPermissionTest(APITestCase):
request.user = self.user_3
self.assertFalse(self.permission.has_permission(request, None))
def test_has_permission_false_for_anonymous_user(self):
self.client = APIClient()
request = self.client.get("/").wsgi_request
request.user = self.user_4
self.assertFalse(self.permission.has_permission(request, None))
class CreateOnlyPermissionTest(APITestCase):
@classmethod
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment