mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Completed test coverage of views.static.directory_name().
This commit is contained in:
parent
10d82c85aa
commit
6a8b57df6a
1
tests/view_tests/media/subdir/.hidden
Normal file
1
tests/view_tests/media/subdir/.hidden
Normal file
@ -0,0 +1 @@
|
||||
The directory_name() view ignores files that start with a dot.
|
0
tests/view_tests/media/subdir/visible
Normal file
0
tests/view_tests/media/subdir/visible
Normal file
@ -111,6 +111,14 @@ class StaticTests(SimpleTestCase):
|
||||
def test_index(self):
|
||||
response = self.client.get('/%s/' % self.prefix)
|
||||
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=[{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
|
Loading…
Reference in New Issue
Block a user