Completed test coverage of views.static.directory_name().
This commit is contained in:
parent
10d82c85aa
commit
6a8b57df6a
|
@ -0,0 +1 @@
|
||||||
|
The directory_name() view ignores files that start with a dot.
|
|
@ -111,6 +111,14 @@ class StaticTests(SimpleTestCase):
|
||||||
def test_index(self):
|
def test_index(self):
|
||||||
response = self.client.get('/%s/' % self.prefix)
|
response = self.client.get('/%s/' % self.prefix)
|
||||||
self.assertContains(response, 'Index of ./')
|
self.assertContains(response, 'Index of ./')
|
||||||
|
# Directories have a trailing slash.
|
||||||
|
self.assertIn('subdir/', response.context['file_list'])
|
||||||
|
|
||||||
|
def test_index_subdir(self):
|
||||||
|
response = self.client.get('/%s/subdir/' % self.prefix)
|
||||||
|
self.assertContains(response, 'Index of subdir/')
|
||||||
|
# File with a leading dot (e.g. .hidden) aren't displayed.
|
||||||
|
self.assertEqual(response.context['file_list'], ['visible'])
|
||||||
|
|
||||||
@override_settings(TEMPLATES=[{
|
@override_settings(TEMPLATES=[{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
|
Loading…
Reference in New Issue