Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-notes-api
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
edx-notes-api
Commits
37bb8a6f
Commit
37bb8a6f
authored
Dec 30, 2014
by
Oleg Marshev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quality fix.
parent
2eff9cdc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
9 deletions
+6
-9
notesapi/v1/models.py
+1
-1
notesapi/v1/permissions.py
+4
-6
notesapi/v1/tests/test_views.py
+1
-2
No files found.
notesapi/v1/models.py
View file @
37bb8a6f
...
@@ -4,7 +4,7 @@ from django.core.exceptions import ValidationError
...
@@ -4,7 +4,7 @@ from django.core.exceptions import ValidationError
from
django.conf
import
settings
from
django.conf
import
settings
from
django.db.models
import
signals
from
django.db.models
import
signals
from
django.dispatch
import
receiver
from
django.dispatch
import
receiver
from
elasticutils.contrib.django
import
Indexable
,
MappingType
,
get_es
from
elasticutils.contrib.django
import
Indexable
,
MappingType
class
Note
(
models
.
Model
):
class
Note
(
models
.
Model
):
...
...
notesapi/v1/permissions.py
View file @
37bb8a6f
...
@@ -46,15 +46,13 @@ class HasAccessToken(BasePermission):
...
@@ -46,15 +46,13 @@ class HasAccessToken(BasePermission):
if
req_user
==
auth_user
:
if
req_user
==
auth_user
:
return
True
return
True
else
:
else
:
logger
.
debug
(
"Token user {auth_user} did not match {field} user {req_user}"
.
format
(
logger
.
debug
(
"Token user
%
s did not match
%
s user
%
s"
,
auth_user
,
request_field
,
req_user
)
auth_user
=
auth_user
,
field
=
request_field
,
req_user
=
req_user
))
return
False
return
False
logger
.
info
(
"No user was present to compare in GET, POST or DATA"
)
logger
.
info
(
"No user was present to compare in GET, POST or DATA"
)
except
jwt
.
ExpiredSignature
:
except
jwt
.
ExpiredSignature
:
logger
.
debug
(
"Token was expired:
{}"
.
format
(
token
)
)
logger
.
debug
(
"Token was expired:
%
s"
,
token
)
except
jwt
.
DecodeError
:
except
jwt
.
DecodeError
:
logger
.
debug
(
"Could not decode token
{}"
.
format
(
token
)
)
logger
.
debug
(
"Could not decode token
%
s"
,
token
)
except
TokenWrongIssuer
:
except
TokenWrongIssuer
:
logger
.
debug
(
"Token has wrong issuer
{}"
.
format
(
token
)
)
logger
.
debug
(
"Token has wrong issuer
%
s"
,
token
)
return
False
return
False
notesapi/v1/tests/test_views.py
View file @
37bb8a6f
...
@@ -67,7 +67,7 @@ class BaseAnnotationViewTests(APITestCase):
...
@@ -67,7 +67,7 @@ class BaseAnnotationViewTests(APITestCase):
get_es
()
.
indices
.
delete
(
index
=
settings
.
ES_INDEXES
[
'default'
])
get_es
()
.
indices
.
delete
(
index
=
settings
.
ES_INDEXES
[
'default'
])
get_es
()
.
indices
.
refresh
()
get_es
()
.
indices
.
refresh
()
def
_create_annotation
(
self
,
refresh
=
True
,
**
kwargs
):
def
_create_annotation
(
self
,
**
kwargs
):
"""
"""
Create annotation
Create annotation
"""
"""
...
@@ -170,7 +170,6 @@ class AnnotationViewTests(BaseAnnotationViewTests):
...
@@ -170,7 +170,6 @@ class AnnotationViewTests(BaseAnnotationViewTests):
Test if annotation 'updated' field is not used by API.
Test if annotation 'updated' field is not used by API.
"""
"""
self
.
payload
[
'updated'
]
=
'abc'
self
.
payload
[
'updated'
]
=
'abc'
payload
=
self
.
payload
response
=
self
.
client
.
post
(
reverse
(
'api:v1:annotations'
),
self
.
payload
,
format
=
'json'
)
response
=
self
.
client
.
post
(
reverse
(
'api:v1:annotations'
),
self
.
payload
,
format
=
'json'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
...
...
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