diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conftest.py | 1 | ||||
| -rw-r--r-- | tests/test_authentication.py | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index f3723aea..4b33e19c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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, diff --git a/tests/test_authentication.py b/tests/test_authentication.py index 2b9d73e4..32041f9c 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -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,15 @@ 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. |
