From 210849cbbde0c7d841d18b30e7915c3b690eb285 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 12 Dec 2016 11:12:17 +0000 Subject: [PATCH] Update tests and pep8 fixes --- rest_framework/documentation.py | 2 +- rest_framework/schemas.py | 2 +- tests/test_schemas.py | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rest_framework/documentation.py b/rest_framework/documentation.py index d63fe11a1..3ec8e0936 100644 --- a/rest_framework/documentation.py +++ b/rest_framework/documentation.py @@ -1,4 +1,4 @@ -from rest_framework.renderers import DocumentationRenderer, CoreJSONRenderer +from rest_framework.renderers import CoreJSONRenderer, DocumentationRenderer from rest_framework.schemas import get_schema_view diff --git a/rest_framework/schemas.py b/rest_framework/schemas.py index e497add7c..654aa31d8 100644 --- a/rest_framework/schemas.py +++ b/rest_framework/schemas.py @@ -128,6 +128,7 @@ def get_pk_description(model, model_field): name=model._meta.verbose_name, ) + class EndpointInspector(object): """ A class to determine the available API endpoints that a project exposes. @@ -487,7 +488,6 @@ class SchemaGenerator(object): elif model_field is not None and model_field.primary_key: description = get_pk_description(model, model_field) - field = coreapi.Field( name=variable, location='path', diff --git a/tests/test_schemas.py b/tests/test_schemas.py index e196a1f61..24c3f8d82 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -92,7 +92,7 @@ class TestRouterGeneratedSchema(TestCase): response = client.get('/', HTTP_ACCEPT='application/coreapi+json') self.assertEqual(response.status_code, 200) expected = coreapi.Document( - url='', + url='http://testserver/', title='Example API', content={ 'example': { @@ -100,8 +100,8 @@ class TestRouterGeneratedSchema(TestCase): url='/example/', action='get', fields=[ - coreapi.Field('page', required=False, location='query'), - coreapi.Field('page_size', required=False, location='query'), + coreapi.Field('page', required=False, location='query', description='A page number within the paginated result set.'), + coreapi.Field('page_size', required=False, location='query', description='Number of results to return per page.'), coreapi.Field('ordering', required=False, location='query') ] ), @@ -133,7 +133,7 @@ class TestRouterGeneratedSchema(TestCase): response = client.get('/', HTTP_ACCEPT='application/coreapi+json') self.assertEqual(response.status_code, 200) expected = coreapi.Document( - url='', + url='http://testserver/', title='Example API', content={ 'example': { @@ -141,8 +141,8 @@ class TestRouterGeneratedSchema(TestCase): url='/example/', action='get', fields=[ - coreapi.Field('page', required=False, location='query'), - coreapi.Field('page_size', required=False, location='query'), + coreapi.Field('page', required=False, location='query', description='A page number within the paginated result set.'), + coreapi.Field('page_size', required=False, location='query', description='Number of results to return per page.'), coreapi.Field('ordering', required=False, location='query') ] ), @@ -388,7 +388,7 @@ class TestSchemaGeneratorWithRestrictedViewSets(TestCase): request = factory.get('/') schema = generator.get_schema(Request(request)) expected = coreapi.Document( - url='', + url='http://testserver/', title='Example API', content={ 'example': {