From 3893d7c469ef9441a8fb4139e4575a9c3891edce Mon Sep 17 00:00:00 2001 From: Dan Bate Date: Thu, 13 Sep 2018 16:47:40 +0100 Subject: [PATCH] added method specific docs test for action mapping --- tests/test_schemas.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/test_schemas.py b/tests/test_schemas.py index cc7174cb2..ad2e34a4b 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -125,6 +125,13 @@ class ExampleViewSet(ModelViewSet): """ pass + @documented_custom_action.mapping.put + def put_documented_custom_action(self, request, *args, **kwargs): + """ + A description of the put method on the custom action from mapping. + """ + pass + if coreapi: schema_view = get_schema_view(title='Example API') @@ -296,7 +303,17 @@ class TestRouterGeneratedSchema(TestCase): coreapi.Field('a', required=True, location='form', schema=coreschema.String(title='A', description='A field description')), coreapi.Field('b', required=False, location='form', schema=coreschema.String(title='B')) ] - ) + ), + 'update': coreapi.Link( + url='/example/documented_custom_action/', + action='put', + description='A description of the put method on the custom action from mapping.', + encoding='application/json', + fields=[ + coreapi.Field('a', required=True, location='form', schema=coreschema.String(title='A', description='A field description')), + coreapi.Field('b', required=False, location='form', schema=coreschema.String(title='B')) + ] + ), }, 'update': coreapi.Link( url='/example/{id}/',