mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
add test case for tag generation from view-set
This commit is contained in:
parent
ee97de3269
commit
31a1eb14eb
|
@ -785,16 +785,22 @@ class TestOperationIntrospection(TestCase):
|
|||
class Example(views.ExampleTagsViewSet):
|
||||
pass
|
||||
|
||||
class PascalCaseXYZTestIp(views.ExampleTagsViewSet):
|
||||
pass
|
||||
|
||||
router = routers.SimpleRouter()
|
||||
router.register('test1', ExampleIPViewSet, basename="test")
|
||||
router.register('test2', ExampleXYZView, basename="test")
|
||||
router.register('test3', Example, basename="test")
|
||||
router.register('test1', ExampleIPViewSet, basename="test1")
|
||||
router.register('test2', ExampleXYZView, basename="test2")
|
||||
router.register('test3', Example, basename="test3")
|
||||
router.register('test4', PascalCaseXYZTestIp, basename="test4")
|
||||
|
||||
generator = SchemaGenerator(patterns=router.urls)
|
||||
schema = generator.get_schema(request=create_request('/'))
|
||||
assert schema['paths']['/test1/{id}/']['get']['tags'] == ['example ip']
|
||||
assert schema['paths']['/test2/{id}/']['get']['tags'] == ['example xyz']
|
||||
assert schema['paths']['/test3/{id}/']['get']['tags'] == ['example']
|
||||
assert schema['paths']['/test4/{id}/']['get']['tags'] == ['pascal case xyz test ip']
|
||||
|
||||
assert schema['tags'] == []
|
||||
|
||||
def test_auto_generated_apiview_tags(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user