Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Julien Jerphanion
Rex Dri
Commits
a57a45ae
Commit
a57a45ae
authored
Aug 26, 2018
by
Florent Chehab
Browse files
Moved test_read
parent
77048105
Changes
2
Show whitespace changes
Inline
Side-by-side
backend/tests/test_moderation.py
View file @
a57a45ae
...
...
@@ -8,25 +8,11 @@ from django.conf import settings
class
ModerationTestCase
(
WithUserTestCase
):
def
test_setting_ok
(
self
):
self
.
assertTrue
(
settings
.
TESTING
)
def
moreSetUp
(
self
):
self
.
api_moderation
=
'/api/test/moderation/'
def
test_read
(
self
):
"""
TODO à déplacer ailleur
Basic tests to check read access rights
"""
response
=
self
.
staff_client
.
get
(
self
.
api_moderation
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response
=
self
.
authenticated_client
.
get
(
self
.
api_moderation
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response
=
self
.
unauthenticated_client
.
get
(
self
.
api_moderation
)
self
.
assertEqual
(
response
.
status_code
,
403
)
def
test_setting_ok
(
self
):
self
.
assertTrue
(
settings
.
TESTING
)
@
override_settings
(
MODERATION_ACTIVATED
=
True
)
def
test_moderation_activated
(
self
):
...
...
backend/tests/test_read_access.py
0 → 100644
View file @
a57a45ae
from
.withUserTestCase
import
WithUserTestCase
class
ReadAccessTestCase
(
WithUserTestCase
):
def
moreSetUp
(
self
):
self
.
api_moderation
=
'/api/test/moderation/'
def
test_read
(
self
):
"""
Basic tests to check read access rights
On MyModelViewset
"""
response
=
self
.
staff_client
.
get
(
self
.
api_moderation
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response
=
self
.
moderator_client
.
get
(
self
.
api_moderation
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response
=
self
.
authenticated_client
.
get
(
self
.
api_moderation
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response
=
self
.
unauthenticated_client
.
get
(
self
.
api_moderation
)
self
.
assertEqual
(
response
.
status_code
,
403
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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