diff options
| author | tom christie tom@tomchristie.com | 2011-02-19 10:26:27 +0000 |
|---|---|---|
| committer | tom christie tom@tomchristie.com | 2011-02-19 10:26:27 +0000 |
| commit | 805aa03ec1871f6a766d9052b348ddce9e9843c3 (patch) | |
| tree | 8ab5b6a7396236aa45bbc61e8404cc77fc75a9c5 /djangorestframework/tests/views.py | |
| parent | b749b950a1b4bede76b7e3900a6385779904902d (diff) | |
| download | django-rest-framework-805aa03ec1871f6a766d9052b348ddce9e9843c3.tar.bz2 | |
Yowzers. Final big bunch of refactoring for 0.1 release. Now support Django 1.3's views, admin style api is all polished off, loads of tests, new test project for running the test. All sorts of goodness. Getting ready to push this out now.
Diffstat (limited to 'djangorestframework/tests/views.py')
| -rw-r--r-- | djangorestframework/tests/views.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/djangorestframework/tests/views.py b/djangorestframework/tests/views.py new file mode 100644 index 00000000..9e2e893f --- /dev/null +++ b/djangorestframework/tests/views.py @@ -0,0 +1,43 @@ +from django.conf.urls.defaults import patterns, url +from django.test import TestCase +from django.test import Client + + +urlpatterns = patterns('djangorestframework.views', + url(r'^robots.txt$', 'deny_robots'), + url(r'^favicon.ico$', 'favicon'), + url(r'^accounts/login$', 'api_login'), + url(r'^accounts/logout$', 'api_logout'), +) + + +class ViewTests(TestCase): + """Test the extra views djangorestframework provides""" + urls = 'djangorestframework.tests.views' + + def test_robots_view(self): + """Ensure the robots view exists""" + response = self.client.get('/robots.txt') + self.assertEqual(response.status_code, 200) + self.assertEqual(response['Content-Type'], 'text/plain') + + def test_favicon_view(self): + """Ensure the favicon view exists""" + response = self.client.get('/favicon.ico') + self.assertEqual(response.status_code, 200) + self.assertEqual(response['Content-Type'], 'image/vnd.microsoft.icon') + + def test_login_view(self): + """Ensure the login view exists""" + response = self.client.get('/accounts/login') + self.assertEqual(response.status_code, 200) + self.assertEqual(response['Content-Type'].split(';')[0], 'text/html') + + def test_logout_view(self): + """Ensure the logout view exists""" + response = self.client.get('/accounts/logout') + self.assertEqual(response.status_code, 200) + self.assertEqual(response['Content-Type'].split(';')[0], 'text/html') + + + # TODO: Add login/logout behaviour tests |
