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
c2c12858
Commit
c2c12858
authored
Feb 25, 2013
by
Omer Katz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced status numbers with the statuses constants from the status model.
parent
62be5470
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
27 deletions
+29
-27
rest_framework/tests/authentication.py
+15
-14
rest_framework/tests/decorators.py
+6
-6
rest_framework/tests/htmlrenderer.py
+5
-4
rest_framework/tests/renderers.py
+3
-3
No files found.
rest_framework/tests/authentication.py
View file @
c2c12858
...
@@ -4,6 +4,7 @@ from django.http import HttpResponse
...
@@ -4,6 +4,7 @@ from django.http import HttpResponse
from
django.test
import
Client
,
TestCase
from
django.test
import
Client
,
TestCase
from
rest_framework
import
HTTP_HEADER_ENCODING
from
rest_framework
import
HTTP_HEADER_ENCODING
from
rest_framework
import
permissions
from
rest_framework
import
permissions
from
rest_framework
import
status
from
rest_framework.authtoken.models
import
Token
from
rest_framework.authtoken.models
import
Token
from
rest_framework.authentication
import
TokenAuthentication
,
BasicAuthentication
,
SessionAuthentication
from
rest_framework.authentication
import
TokenAuthentication
,
BasicAuthentication
,
SessionAuthentication
from
rest_framework.compat
import
patterns
from
rest_framework.compat
import
patterns
...
@@ -46,7 +47,7 @@ class BasicAuthTests(TestCase):
...
@@ -46,7 +47,7 @@ class BasicAuthTests(TestCase):
base64_credentials
=
base64
.
b64encode
(
credentials
.
encode
(
HTTP_HEADER_ENCODING
))
.
decode
(
HTTP_HEADER_ENCODING
)
base64_credentials
=
base64
.
b64encode
(
credentials
.
encode
(
HTTP_HEADER_ENCODING
))
.
decode
(
HTTP_HEADER_ENCODING
)
auth
=
'Basic
%
s'
%
base64_credentials
auth
=
'Basic
%
s'
%
base64_credentials
response
=
self
.
csrf_client
.
post
(
'/basic/'
,
{
'example'
:
'example'
},
HTTP_AUTHORIZATION
=
auth
)
response
=
self
.
csrf_client
.
post
(
'/basic/'
,
{
'example'
:
'example'
},
HTTP_AUTHORIZATION
=
auth
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
def
test_post_json_passing_basic_auth
(
self
):
def
test_post_json_passing_basic_auth
(
self
):
"""Ensure POSTing form over basic auth with correct credentials passes and does not require CSRF"""
"""Ensure POSTing form over basic auth with correct credentials passes and does not require CSRF"""
...
@@ -54,17 +55,17 @@ class BasicAuthTests(TestCase):
...
@@ -54,17 +55,17 @@ class BasicAuthTests(TestCase):
base64_credentials
=
base64
.
b64encode
(
credentials
.
encode
(
HTTP_HEADER_ENCODING
))
.
decode
(
HTTP_HEADER_ENCODING
)
base64_credentials
=
base64
.
b64encode
(
credentials
.
encode
(
HTTP_HEADER_ENCODING
))
.
decode
(
HTTP_HEADER_ENCODING
)
auth
=
'Basic
%
s'
%
base64_credentials
auth
=
'Basic
%
s'
%
base64_credentials
response
=
self
.
csrf_client
.
post
(
'/basic/'
,
json
.
dumps
({
'example'
:
'example'
}),
'application/json'
,
HTTP_AUTHORIZATION
=
auth
)
response
=
self
.
csrf_client
.
post
(
'/basic/'
,
json
.
dumps
({
'example'
:
'example'
}),
'application/json'
,
HTTP_AUTHORIZATION
=
auth
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
def
test_post_form_failing_basic_auth
(
self
):
def
test_post_form_failing_basic_auth
(
self
):
"""Ensure POSTing form over basic auth without correct credentials fails"""
"""Ensure POSTing form over basic auth without correct credentials fails"""
response
=
self
.
csrf_client
.
post
(
'/basic/'
,
{
'example'
:
'example'
})
response
=
self
.
csrf_client
.
post
(
'/basic/'
,
{
'example'
:
'example'
})
self
.
assertEqual
(
response
.
status_code
,
401
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_401_UNAUTHORIZED
)
def
test_post_json_failing_basic_auth
(
self
):
def
test_post_json_failing_basic_auth
(
self
):
"""Ensure POSTing json over basic auth without correct credentials fails"""
"""Ensure POSTing json over basic auth without correct credentials fails"""
response
=
self
.
csrf_client
.
post
(
'/basic/'
,
json
.
dumps
({
'example'
:
'example'
}),
'application/json'
)
response
=
self
.
csrf_client
.
post
(
'/basic/'
,
json
.
dumps
({
'example'
:
'example'
}),
'application/json'
)
self
.
assertEqual
(
response
.
status_code
,
401
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_401_UNAUTHORIZED
)
self
.
assertEqual
(
response
[
'WWW-Authenticate'
],
'Basic realm="api"'
)
self
.
assertEqual
(
response
[
'WWW-Authenticate'
],
'Basic realm="api"'
)
...
@@ -89,7 +90,7 @@ class SessionAuthTests(TestCase):
...
@@ -89,7 +90,7 @@ class SessionAuthTests(TestCase):
"""
"""
self
.
csrf_client
.
login
(
username
=
self
.
username
,
password
=
self
.
password
)
self
.
csrf_client
.
login
(
username
=
self
.
username
,
password
=
self
.
password
)
response
=
self
.
csrf_client
.
post
(
'/session/'
,
{
'example'
:
'example'
})
response
=
self
.
csrf_client
.
post
(
'/session/'
,
{
'example'
:
'example'
})
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_403_FORBIDDEN
)
def
test_post_form_session_auth_passing
(
self
):
def
test_post_form_session_auth_passing
(
self
):
"""
"""
...
@@ -97,7 +98,7 @@ class SessionAuthTests(TestCase):
...
@@ -97,7 +98,7 @@ class SessionAuthTests(TestCase):
"""
"""
self
.
non_csrf_client
.
login
(
username
=
self
.
username
,
password
=
self
.
password
)
self
.
non_csrf_client
.
login
(
username
=
self
.
username
,
password
=
self
.
password
)
response
=
self
.
non_csrf_client
.
post
(
'/session/'
,
{
'example'
:
'example'
})
response
=
self
.
non_csrf_client
.
post
(
'/session/'
,
{
'example'
:
'example'
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
def
test_put_form_session_auth_passing
(
self
):
def
test_put_form_session_auth_passing
(
self
):
"""
"""
...
@@ -105,14 +106,14 @@ class SessionAuthTests(TestCase):
...
@@ -105,14 +106,14 @@ class SessionAuthTests(TestCase):
"""
"""
self
.
non_csrf_client
.
login
(
username
=
self
.
username
,
password
=
self
.
password
)
self
.
non_csrf_client
.
login
(
username
=
self
.
username
,
password
=
self
.
password
)
response
=
self
.
non_csrf_client
.
put
(
'/session/'
,
{
'example'
:
'example'
})
response
=
self
.
non_csrf_client
.
put
(
'/session/'
,
{
'example'
:
'example'
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
def
test_post_form_session_auth_failing
(
self
):
def
test_post_form_session_auth_failing
(
self
):
"""
"""
Ensure POSTing form over session authentication without logged in user fails.
Ensure POSTing form over session authentication without logged in user fails.
"""
"""
response
=
self
.
csrf_client
.
post
(
'/session/'
,
{
'example'
:
'example'
})
response
=
self
.
csrf_client
.
post
(
'/session/'
,
{
'example'
:
'example'
})
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_403_FORBIDDEN
)
class
TokenAuthTests
(
TestCase
):
class
TokenAuthTests
(
TestCase
):
...
@@ -133,23 +134,23 @@ class TokenAuthTests(TestCase):
...
@@ -133,23 +134,23 @@ class TokenAuthTests(TestCase):
"""Ensure POSTing json over token auth with correct credentials passes and does not require CSRF"""
"""Ensure POSTing json over token auth with correct credentials passes and does not require CSRF"""
auth
=
"Token "
+
self
.
key
auth
=
"Token "
+
self
.
key
response
=
self
.
csrf_client
.
post
(
'/token/'
,
{
'example'
:
'example'
},
HTTP_AUTHORIZATION
=
auth
)
response
=
self
.
csrf_client
.
post
(
'/token/'
,
{
'example'
:
'example'
},
HTTP_AUTHORIZATION
=
auth
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
def
test_post_json_passing_token_auth
(
self
):
def
test_post_json_passing_token_auth
(
self
):
"""Ensure POSTing form over token auth with correct credentials passes and does not require CSRF"""
"""Ensure POSTing form over token auth with correct credentials passes and does not require CSRF"""
auth
=
"Token "
+
self
.
key
auth
=
"Token "
+
self
.
key
response
=
self
.
csrf_client
.
post
(
'/token/'
,
json
.
dumps
({
'example'
:
'example'
}),
'application/json'
,
HTTP_AUTHORIZATION
=
auth
)
response
=
self
.
csrf_client
.
post
(
'/token/'
,
json
.
dumps
({
'example'
:
'example'
}),
'application/json'
,
HTTP_AUTHORIZATION
=
auth
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
def
test_post_form_failing_token_auth
(
self
):
def
test_post_form_failing_token_auth
(
self
):
"""Ensure POSTing form over token auth without correct credentials fails"""
"""Ensure POSTing form over token auth without correct credentials fails"""
response
=
self
.
csrf_client
.
post
(
'/token/'
,
{
'example'
:
'example'
})
response
=
self
.
csrf_client
.
post
(
'/token/'
,
{
'example'
:
'example'
})
self
.
assertEqual
(
response
.
status_code
,
401
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_401_UNAUTHORIZED
)
def
test_post_json_failing_token_auth
(
self
):
def
test_post_json_failing_token_auth
(
self
):
"""Ensure POSTing json over token auth without correct credentials fails"""
"""Ensure POSTing json over token auth without correct credentials fails"""
response
=
self
.
csrf_client
.
post
(
'/token/'
,
json
.
dumps
({
'example'
:
'example'
}),
'application/json'
)
response
=
self
.
csrf_client
.
post
(
'/token/'
,
json
.
dumps
({
'example'
:
'example'
}),
'application/json'
)
self
.
assertEqual
(
response
.
status_code
,
401
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_401_UNAUTHORIZED
)
def
test_token_has_auto_assigned_key_if_none_provided
(
self
):
def
test_token_has_auto_assigned_key_if_none_provided
(
self
):
"""Ensure creating a token with no key will auto-assign a key"""
"""Ensure creating a token with no key will auto-assign a key"""
...
@@ -162,7 +163,7 @@ class TokenAuthTests(TestCase):
...
@@ -162,7 +163,7 @@ class TokenAuthTests(TestCase):
client
=
Client
(
enforce_csrf_checks
=
True
)
client
=
Client
(
enforce_csrf_checks
=
True
)
response
=
client
.
post
(
'/auth-token/'
,
response
=
client
.
post
(
'/auth-token/'
,
json
.
dumps
({
'username'
:
self
.
username
,
'password'
:
self
.
password
}),
'application/json'
)
json
.
dumps
({
'username'
:
self
.
username
,
'password'
:
self
.
password
}),
'application/json'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
self
.
assertEqual
(
json
.
loads
(
response
.
content
.
decode
(
'ascii'
))[
'token'
],
self
.
key
)
self
.
assertEqual
(
json
.
loads
(
response
.
content
.
decode
(
'ascii'
))[
'token'
],
self
.
key
)
def
test_token_login_json_bad_creds
(
self
):
def
test_token_login_json_bad_creds
(
self
):
...
@@ -184,5 +185,5 @@ class TokenAuthTests(TestCase):
...
@@ -184,5 +185,5 @@ class TokenAuthTests(TestCase):
client
=
Client
(
enforce_csrf_checks
=
True
)
client
=
Client
(
enforce_csrf_checks
=
True
)
response
=
client
.
post
(
'/auth-token/'
,
response
=
client
.
post
(
'/auth-token/'
,
{
'username'
:
self
.
username
,
'password'
:
self
.
password
})
{
'username'
:
self
.
username
,
'password'
:
self
.
password
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
self
.
assertEqual
(
json
.
loads
(
response
.
content
.
decode
(
'ascii'
))[
'token'
],
self
.
key
)
self
.
assertEqual
(
json
.
loads
(
response
.
content
.
decode
(
'ascii'
))[
'token'
],
self
.
key
)
rest_framework/tests/decorators.py
View file @
c2c12858
...
@@ -59,11 +59,11 @@ class DecoratorTestCase(TestCase):
...
@@ -59,11 +59,11 @@ class DecoratorTestCase(TestCase):
request
=
self
.
factory
.
get
(
'/'
)
request
=
self
.
factory
.
get
(
'/'
)
response
=
view
(
request
)
response
=
view
(
request
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
request
=
self
.
factory
.
post
(
'/'
)
request
=
self
.
factory
.
post
(
'/'
)
response
=
view
(
request
)
response
=
view
(
request
)
self
.
assertEqual
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_405_METHOD_NOT_ALLOWED
)
def
test_calling_put_method
(
self
):
def
test_calling_put_method
(
self
):
...
@@ -73,11 +73,11 @@ class DecoratorTestCase(TestCase):
...
@@ -73,11 +73,11 @@ class DecoratorTestCase(TestCase):
request
=
self
.
factory
.
put
(
'/'
)
request
=
self
.
factory
.
put
(
'/'
)
response
=
view
(
request
)
response
=
view
(
request
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
request
=
self
.
factory
.
post
(
'/'
)
request
=
self
.
factory
.
post
(
'/'
)
response
=
view
(
request
)
response
=
view
(
request
)
self
.
assertEqual
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_405_METHOD_NOT_ALLOWED
)
def
test_calling_patch_method
(
self
):
def
test_calling_patch_method
(
self
):
...
@@ -87,11 +87,11 @@ class DecoratorTestCase(TestCase):
...
@@ -87,11 +87,11 @@ class DecoratorTestCase(TestCase):
request
=
self
.
factory
.
patch
(
'/'
)
request
=
self
.
factory
.
patch
(
'/'
)
response
=
view
(
request
)
response
=
view
(
request
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
request
=
self
.
factory
.
post
(
'/'
)
request
=
self
.
factory
.
post
(
'/'
)
response
=
view
(
request
)
response
=
view
(
request
)
self
.
assertEqual
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_405_METHOD_NOT_ALLOWED
)
def
test_renderer_classes
(
self
):
def
test_renderer_classes
(
self
):
...
...
rest_framework/tests/htmlrenderer.py
View file @
c2c12858
...
@@ -4,6 +4,7 @@ from django.http import Http404
...
@@ -4,6 +4,7 @@ from django.http import Http404
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.template
import
TemplateDoesNotExist
,
Template
from
django.template
import
TemplateDoesNotExist
,
Template
import
django.template.loader
import
django.template.loader
from
rest_framework
import
status
from
rest_framework.compat
import
patterns
,
url
from
rest_framework.compat
import
patterns
,
url
from
rest_framework.decorators
import
api_view
,
renderer_classes
from
rest_framework.decorators
import
api_view
,
renderer_classes
from
rest_framework.renderers
import
TemplateHTMLRenderer
from
rest_framework.renderers
import
TemplateHTMLRenderer
...
@@ -69,13 +70,13 @@ class TemplateHTMLRendererTests(TestCase):
...
@@ -69,13 +70,13 @@ class TemplateHTMLRendererTests(TestCase):
def
test_not_found_html_view
(
self
):
def
test_not_found_html_view
(
self
):
response
=
self
.
client
.
get
(
'/not_found'
)
response
=
self
.
client
.
get
(
'/not_found'
)
self
.
assertEquals
(
response
.
status_code
,
404
)
self
.
assertEquals
(
response
.
status_code
,
status
.
HTTP_404_NOT_FOUND
)
self
.
assertEquals
(
response
.
content
,
six
.
b
(
"404 Not Found"
))
self
.
assertEquals
(
response
.
content
,
six
.
b
(
"404 Not Found"
))
self
.
assertEquals
(
response
[
'Content-Type'
],
'text/html'
)
self
.
assertEquals
(
response
[
'Content-Type'
],
'text/html'
)
def
test_permission_denied_html_view
(
self
):
def
test_permission_denied_html_view
(
self
):
response
=
self
.
client
.
get
(
'/permission_denied'
)
response
=
self
.
client
.
get
(
'/permission_denied'
)
self
.
assertEquals
(
response
.
status_code
,
403
)
self
.
assertEquals
(
response
.
status_code
,
status
.
HTTP_403_FORBIDDEN
)
self
.
assertEquals
(
response
.
content
,
six
.
b
(
"403 Forbidden"
))
self
.
assertEquals
(
response
.
content
,
six
.
b
(
"403 Forbidden"
))
self
.
assertEquals
(
response
[
'Content-Type'
],
'text/html'
)
self
.
assertEquals
(
response
[
'Content-Type'
],
'text/html'
)
...
@@ -106,12 +107,12 @@ class TemplateHTMLRendererExceptionTests(TestCase):
...
@@ -106,12 +107,12 @@ class TemplateHTMLRendererExceptionTests(TestCase):
def
test_not_found_html_view_with_template
(
self
):
def
test_not_found_html_view_with_template
(
self
):
response
=
self
.
client
.
get
(
'/not_found'
)
response
=
self
.
client
.
get
(
'/not_found'
)
self
.
assertEquals
(
response
.
status_code
,
404
)
self
.
assertEquals
(
response
.
status_code
,
status
.
HTTP_404_NOT_FOUND
)
self
.
assertEquals
(
response
.
content
,
six
.
b
(
"404: Not found"
))
self
.
assertEquals
(
response
.
content
,
six
.
b
(
"404: Not found"
))
self
.
assertEquals
(
response
[
'Content-Type'
],
'text/html'
)
self
.
assertEquals
(
response
[
'Content-Type'
],
'text/html'
)
def
test_permission_denied_html_view_with_template
(
self
):
def
test_permission_denied_html_view_with_template
(
self
):
response
=
self
.
client
.
get
(
'/permission_denied'
)
response
=
self
.
client
.
get
(
'/permission_denied'
)
self
.
assertEquals
(
response
.
status_code
,
403
)
self
.
assertEquals
(
response
.
status_code
,
status
.
HTTP_403_FORBIDDEN
)
self
.
assertEquals
(
response
.
content
,
six
.
b
(
"403: Permission denied"
))
self
.
assertEquals
(
response
.
content
,
six
.
b
(
"403: Permission denied"
))
self
.
assertEquals
(
response
[
'Content-Type'
],
'text/html'
)
self
.
assertEquals
(
response
[
'Content-Type'
],
'text/html'
)
rest_framework/tests/renderers.py
View file @
c2c12858
...
@@ -268,7 +268,7 @@ class JSONPRendererTests(TestCase):
...
@@ -268,7 +268,7 @@ class JSONPRendererTests(TestCase):
"""
"""
resp
=
self
.
client
.
get
(
'/jsonp/jsonrenderer'
,
resp
=
self
.
client
.
get
(
'/jsonp/jsonrenderer'
,
HTTP_ACCEPT
=
'application/javascript'
)
HTTP_ACCEPT
=
'application/javascript'
)
self
.
assertEquals
(
resp
.
status_code
,
200
)
self
.
assertEquals
(
resp
.
status_code
,
status
.
HTTP_200_OK
)
self
.
assertEquals
(
resp
[
'Content-Type'
],
'application/javascript'
)
self
.
assertEquals
(
resp
[
'Content-Type'
],
'application/javascript'
)
self
.
assertEquals
(
resp
.
content
,
self
.
assertEquals
(
resp
.
content
,
(
'callback(
%
s);'
%
_flat_repr
)
.
encode
(
'ascii'
))
(
'callback(
%
s);'
%
_flat_repr
)
.
encode
(
'ascii'
))
...
@@ -279,7 +279,7 @@ class JSONPRendererTests(TestCase):
...
@@ -279,7 +279,7 @@ class JSONPRendererTests(TestCase):
"""
"""
resp
=
self
.
client
.
get
(
'/jsonp/nojsonrenderer'
,
resp
=
self
.
client
.
get
(
'/jsonp/nojsonrenderer'
,
HTTP_ACCEPT
=
'application/javascript'
)
HTTP_ACCEPT
=
'application/javascript'
)
self
.
assertEquals
(
resp
.
status_code
,
200
)
self
.
assertEquals
(
resp
.
status_code
,
status
.
HTTP_200_OK
)
self
.
assertEquals
(
resp
[
'Content-Type'
],
'application/javascript'
)
self
.
assertEquals
(
resp
[
'Content-Type'
],
'application/javascript'
)
self
.
assertEquals
(
resp
.
content
,
self
.
assertEquals
(
resp
.
content
,
(
'callback(
%
s);'
%
_flat_repr
)
.
encode
(
'ascii'
))
(
'callback(
%
s);'
%
_flat_repr
)
.
encode
(
'ascii'
))
...
@@ -291,7 +291,7 @@ class JSONPRendererTests(TestCase):
...
@@ -291,7 +291,7 @@ class JSONPRendererTests(TestCase):
callback_func
=
'myjsonpcallback'
callback_func
=
'myjsonpcallback'
resp
=
self
.
client
.
get
(
'/jsonp/nojsonrenderer?callback='
+
callback_func
,
resp
=
self
.
client
.
get
(
'/jsonp/nojsonrenderer?callback='
+
callback_func
,
HTTP_ACCEPT
=
'application/javascript'
)
HTTP_ACCEPT
=
'application/javascript'
)
self
.
assertEquals
(
resp
.
status_code
,
200
)
self
.
assertEquals
(
resp
.
status_code
,
status
.
HTTP_200_OK
)
self
.
assertEquals
(
resp
[
'Content-Type'
],
'application/javascript'
)
self
.
assertEquals
(
resp
[
'Content-Type'
],
'application/javascript'
)
self
.
assertEquals
(
resp
.
content
,
self
.
assertEquals
(
resp
.
content
,
(
'
%
s(
%
s);'
%
(
callback_func
,
_flat_repr
))
.
encode
(
'ascii'
))
(
'
%
s(
%
s);'
%
(
callback_func
,
_flat_repr
))
.
encode
(
'ascii'
))
...
...
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