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
1c9c5d5c
Commit
1c9c5d5c
authored
Sep 01, 2014
by
Carlton Gibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Regression for #1810: Test login view renders
parent
f777a73b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
rest_framework/urls.py
+1
-1
tests/conftest.py
+1
-0
tests/test_authentication.py
+12
-1
No files found.
rest_framework/urls.py
View file @
1c9c5d5c
...
...
@@ -6,7 +6,7 @@ your API requires authentication:
urlpatterns = patterns('',
...
url(r'^auth', include('rest_framework.urls', namespace='rest_framework'))
url(r'^auth
/
', include('rest_framework.urls', namespace='rest_framework'))
)
The urls must be namespaced as 'rest_framework', and you should make sure
...
...
tests/conftest.py
View file @
1c9c5d5c
...
...
@@ -5,6 +5,7 @@ def pytest_configure():
DEBUG_PROPAGATE_EXCEPTIONS
=
True
,
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.sqlite3'
,
'NAME'
:
':memory:'
}},
SITE_ID
=
1
,
SECRET_KEY
=
'not very secret in tests'
,
USE_I18N
=
True
,
USE_L10N
=
True
,
...
...
tests/test_authentication.py
View file @
1c9c5d5c
...
...
@@ -57,7 +57,8 @@ urlpatterns = patterns(
authentication_classes
=
[
OAuthAuthentication
],
permission_classes
=
[
permissions
.
TokenHasReadWriteScope
]
)
)
),
url
(
r'^auth/'
,
include
(
'rest_framework.urls'
,
namespace
=
'rest_framework'
))
)
...
...
@@ -134,6 +135,16 @@ class SessionAuthTests(TestCase):
def
tearDown
(
self
):
self
.
csrf_client
.
logout
()
def
test_login_view_renders_on_get
(
self
):
"""
Ensure the login template renders for a basic GET.
cf. [#1810](https://github.com/tomchristie/django-rest-framework/pull/1810)
"""
response
=
self
.
csrf_client
.
get
(
'/auth/login/'
)
self
.
assertContains
(
response
,
'<Label class="span4">Username:</label>'
)
def
test_post_form_session_auth_failing_csrf
(
self
):
"""
Ensure POSTing form over session authentication without CSRF token fails.
...
...
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