Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
3d25dadb
Commit
3d25dadb
authored
Feb 11, 2015
by
donewell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change custom message for clarity
parent
9a9a00bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
tests/test_permissions.py
+3
-3
No files found.
tests/test_permissions.py
View file @
3d25dadb
...
@@ -318,7 +318,7 @@ class BasicPerm(permissions.BasePermission):
...
@@ -318,7 +318,7 @@ class BasicPerm(permissions.BasePermission):
class
BasicPermWithDetail
(
permissions
.
BasePermission
):
class
BasicPermWithDetail
(
permissions
.
BasePermission
):
message
=
'Custom: You cannot
post to
this resource'
message
=
'Custom: You cannot
access
this resource'
def
has_permission
(
self
,
request
,
view
):
def
has_permission
(
self
,
request
,
view
):
return
False
return
False
...
@@ -330,7 +330,7 @@ class BasicObjectPerm(permissions.BasePermission):
...
@@ -330,7 +330,7 @@ class BasicObjectPerm(permissions.BasePermission):
class
BasicObjectPermWithDetail
(
permissions
.
BasePermission
):
class
BasicObjectPermWithDetail
(
permissions
.
BasePermission
):
message
=
'Custom: You cannot
post to
this resource'
message
=
'Custom: You cannot
access
this resource'
def
has_object_permission
(
self
,
request
,
view
,
obj
):
def
has_object_permission
(
self
,
request
,
view
,
obj
):
return
False
return
False
...
@@ -371,7 +371,7 @@ class CustomPermissionsTests(TestCase):
...
@@ -371,7 +371,7 @@ class CustomPermissionsTests(TestCase):
User
.
objects
.
create_user
(
'username'
,
'username@example.com'
,
'password'
)
User
.
objects
.
create_user
(
'username'
,
'username@example.com'
,
'password'
)
credentials
=
basic_auth_header
(
'username'
,
'password'
)
credentials
=
basic_auth_header
(
'username'
,
'password'
)
self
.
request
=
factory
.
get
(
'/1'
,
format
=
'json'
,
HTTP_AUTHORIZATION
=
credentials
)
self
.
request
=
factory
.
get
(
'/1'
,
format
=
'json'
,
HTTP_AUTHORIZATION
=
credentials
)
self
.
custom_message
=
'Custom: You cannot
post to
this resource'
self
.
custom_message
=
'Custom: You cannot
access
this resource'
def
test_permission_denied
(
self
):
def
test_permission_denied
(
self
):
response
=
denied_view
(
self
.
request
,
pk
=
1
)
response
=
denied_view
(
self
.
request
,
pk
=
1
)
...
...
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