mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 08:59:54 +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):
|
class Example(views.ExampleTagsViewSet):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class PascalCaseXYZTestIp(views.ExampleTagsViewSet):
|
||||||
|
pass
|
||||||
|
|
||||||
router = routers.SimpleRouter()
|
router = routers.SimpleRouter()
|
||||||
router.register('test1', ExampleIPViewSet, basename="test")
|
router.register('test1', ExampleIPViewSet, basename="test1")
|
||||||
router.register('test2', ExampleXYZView, basename="test")
|
router.register('test2', ExampleXYZView, basename="test2")
|
||||||
router.register('test3', Example, basename="test")
|
router.register('test3', Example, basename="test3")
|
||||||
|
router.register('test4', PascalCaseXYZTestIp, basename="test4")
|
||||||
|
|
||||||
generator = SchemaGenerator(patterns=router.urls)
|
generator = SchemaGenerator(patterns=router.urls)
|
||||||
schema = generator.get_schema(request=create_request('/'))
|
schema = generator.get_schema(request=create_request('/'))
|
||||||
assert schema['paths']['/test1/{id}/']['get']['tags'] == ['example ip']
|
assert schema['paths']['/test1/{id}/']['get']['tags'] == ['example ip']
|
||||||
assert schema['paths']['/test2/{id}/']['get']['tags'] == ['example xyz']
|
assert schema['paths']['/test2/{id}/']['get']['tags'] == ['example xyz']
|
||||||
assert schema['paths']['/test3/{id}/']['get']['tags'] == ['example']
|
assert schema['paths']['/test3/{id}/']['get']['tags'] == ['example']
|
||||||
|
assert schema['paths']['/test4/{id}/']['get']['tags'] == ['pascal case xyz test ip']
|
||||||
|
|
||||||
assert schema['tags'] == []
|
assert schema['tags'] == []
|
||||||
|
|
||||||
def test_auto_generated_apiview_tags(self):
|
def test_auto_generated_apiview_tags(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user