Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2020
PPL-C
PPTI-Mobile Apps Monitoring Wabah Tuberkolosis
Neza-Backend
Commits
67aed26e
Commit
67aed26e
authored
Jun 04, 2020
by
Jonathan Christopher Jakub
Browse files
[RED] Add permission test for anonymous user
parent
71fa0b74
Pipeline
#49746
failed with stages
in 1 minute and 40 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/commons/tests/test_permissions.py
View file @
67aed26e
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment