mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 01:47:59 +03:00 
			
		
		
		
	Correct OpenAPI test for common prefixes.
This commit is contained in:
		
							parent
							
								
									2138f558ce
								
							
						
					
					
						commit
						178a2dc786
					
				| 
						 | 
				
			
			@ -229,18 +229,18 @@ class TestGenerator(TestCase):
 | 
			
		|||
        assert 'post' in example_operations
 | 
			
		||||
 | 
			
		||||
    def test_prefixed_paths_construction(self):
 | 
			
		||||
        """Construction of the `paths` key with a common prefix."""
 | 
			
		||||
        """Construction of the `paths` key maintains a common prefix."""
 | 
			
		||||
        patterns = [
 | 
			
		||||
            url(r'^api/v1/example/?$', views.ExampleListView.as_view()),
 | 
			
		||||
            url(r'^api/v1/example/{pk}/?$', views.ExampleDetailView.as_view()),
 | 
			
		||||
            url(r'^v1/example/?$', views.ExampleListView.as_view()),
 | 
			
		||||
            url(r'^v1/example/{pk}/?$', views.ExampleDetailView.as_view()),
 | 
			
		||||
        ]
 | 
			
		||||
        generator = SchemaGenerator(patterns=patterns)
 | 
			
		||||
        generator._initialise_endpoints()
 | 
			
		||||
 | 
			
		||||
        paths = generator.get_paths()
 | 
			
		||||
 | 
			
		||||
        assert '/example/' in paths
 | 
			
		||||
        assert '/example/{id}/' in paths
 | 
			
		||||
        assert '/v1/example/' in paths
 | 
			
		||||
        assert '/v1/example/{id}/' in paths
 | 
			
		||||
 | 
			
		||||
    def test_schema_construction(self):
 | 
			
		||||
        """Construction of the top level dictionary."""
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user