mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Completed test coverage of views.static.directory_name().
This commit is contained in:
		
				
					committed by
					
						 Tim Graham
						Tim Graham
					
				
			
			
				
	
			
			
			
						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', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user