Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Test that django.views.static.serve() generates 404 status codes.

Also, change tests to be based on SimpleTestCase.
  • Loading branch information...
commit cb92e3391b0560bc3d519f066185522316b4533f 1 parent 00d23a1
Ramiro Morales authored

Showing 1 changed file with 6 additions and 2 deletions. Show diff stats Hide diff stats

  1. 8  tests/view_tests/tests/test_static.py
8  tests/view_tests/tests/test_static.py
@@ -6,7 +6,7 @@
6 6
 
7 7
 from django.conf.urls.static import static
8 8
 from django.http import HttpResponseNotModified
9  
-from django.test import TestCase
  9
+from django.test import SimpleTestCase
10 10
 from django.test.utils import override_settings
11 11
 from django.utils.http import http_date
12 12
 from django.views.static import was_modified_since
@@ -16,7 +16,7 @@
16 16
 
17 17
 
18 18
 @override_settings(DEBUG=True)
19  
-class StaticTests(TestCase):
  19
+class StaticTests(SimpleTestCase):
20 20
     """Tests django views in django/views/static.py"""
21 21
 
22 22
     prefix = 'site_media'
@@ -94,6 +94,10 @@ def test_invalid_if_modified_since2(self):
94 94
         self.assertEqual(len(response_content),
95 95
                           int(response['Content-Length']))
96 96
 
  97
+    def test_404(self):
  98
+        response = self.client.get('/views/%s/non_existing_resource' % self.prefix)
  99
+        self.assertEqual(404, response.status_code)
  100
+
97 101
 
98 102
 class StaticHelperTest(StaticTests):
99 103
     """

0 notes on commit cb92e33

Please sign in to comment.
Something went wrong with that request. Please try again.