summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2013-08-10 15:54:22 -0300
committerRamiro Morales <cramm0@gmail.com>2013-08-10 16:00:22 -0300
commitcb92e3391b0560bc3d519f066185522316b4533f (patch)
tree17e9eca89d2a02efd3aac5aec1da8d82fae8a455
parent00d23a13ebaf6057d1428e798bfb6cf47bb5ef7c (diff)
Test that django.views.static.serve() generates 404 status codes.
Also, change tests to be based on SimpleTestCase.
-rw-r--r--tests/view_tests/tests/test_static.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/view_tests/tests/test_static.py b/tests/view_tests/tests/test_static.py
index d2f3f47fa7..8f67890c11 100644
--- a/tests/view_tests/tests/test_static.py
+++ b/tests/view_tests/tests/test_static.py
@@ -6,7 +6,7 @@ import unittest
from django.conf.urls.static import static
from django.http import HttpResponseNotModified
-from django.test import TestCase
+from django.test import SimpleTestCase
from django.test.utils import override_settings
from django.utils.http import http_date
from django.views.static import was_modified_since
@@ -16,7 +16,7 @@ from ..urls import media_dir
@override_settings(DEBUG=True)
-class StaticTests(TestCase):
+class StaticTests(SimpleTestCase):
"""Tests django views in django/views/static.py"""
prefix = 'site_media'
@@ -94,6 +94,10 @@ class StaticTests(TestCase):
self.assertEqual(len(response_content),
int(response['Content-Length']))
+ def test_404(self):
+ response = self.client.get('/views/%s/non_existing_resource' % self.prefix)
+ self.assertEqual(404, response.status_code)
+
class StaticHelperTest(StaticTests):
"""