mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-12-03 08:13:59 +03:00
Merge 13028a779b into 442444f0be
This commit is contained in:
commit
26d64b75c0
|
|
@ -257,7 +257,6 @@ class TestOperationIntrospection(TestCase):
|
|||
inspector.view = view
|
||||
|
||||
request_body = inspector.get_request_body(path, method)
|
||||
print(request_body)
|
||||
assert request_body['content']['application/json']['schema']['$ref'] == '#/components/schemas/Item'
|
||||
|
||||
components = inspector.get_components(path, method)
|
||||
|
|
@ -928,7 +927,6 @@ class TestOperationIntrospection(TestCase):
|
|||
request = create_request('/')
|
||||
schema = generator.get_schema(request=request)
|
||||
schema_str = str(schema)
|
||||
print(schema_str)
|
||||
assert schema_str.count("operationId") == 2
|
||||
assert schema_str.count("newExample") == 1
|
||||
assert schema_str.count("oldExample") == 1
|
||||
|
|
@ -948,7 +946,6 @@ class TestOperationIntrospection(TestCase):
|
|||
|
||||
assert len(w) == 1
|
||||
assert issubclass(w[-1].category, UserWarning)
|
||||
print(str(w[-1].message))
|
||||
assert 'You have a duplicated operationId' in str(w[-1].message)
|
||||
|
||||
def test_operation_id_viewset(self):
|
||||
|
|
@ -960,7 +957,6 @@ class TestOperationIntrospection(TestCase):
|
|||
|
||||
request = create_request('/')
|
||||
schema = generator.get_schema(request=request)
|
||||
print(schema)
|
||||
assert schema['paths']['/account/']['get']['operationId'] == 'listExampleViewSets'
|
||||
assert schema['paths']['/account/']['post']['operationId'] == 'createExampleViewSet'
|
||||
assert schema['paths']['/account/{id}/']['get']['operationId'] == 'retrieveExampleViewSet'
|
||||
|
|
@ -1284,8 +1280,6 @@ class TestGenerator(TestCase):
|
|||
request = create_request('/')
|
||||
schema = generator.get_schema(request=request)
|
||||
|
||||
print(schema)
|
||||
|
||||
assert 'components' in schema
|
||||
assert 'schemas' in schema['components']
|
||||
assert 'ExampleModel' in schema['components']['schemas']
|
||||
|
|
@ -1299,8 +1293,6 @@ class TestGenerator(TestCase):
|
|||
request = create_request('/')
|
||||
schema = generator.get_schema(request=request)
|
||||
|
||||
print(schema)
|
||||
|
||||
route = schema['paths']['/api-token-auth/']['post']
|
||||
body_schema = route['requestBody']['content']['application/json']['schema']
|
||||
|
||||
|
|
@ -1327,7 +1319,6 @@ class TestGenerator(TestCase):
|
|||
request = create_request('/')
|
||||
schema = generator.get_schema(request=request)
|
||||
|
||||
print(schema)
|
||||
assert 'components' in schema
|
||||
assert 'schemas' in schema['components']
|
||||
assert 'Ulysses' in schema['components']['schemas']
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import datetime
|
|||
import decimal
|
||||
import json # noqa
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
|
@ -159,6 +160,7 @@ class TestModelSerializer(TestCase):
|
|||
|
||||
|
||||
class TestRegularFieldMappings(TestCase):
|
||||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Test not supported on Windows")
|
||||
def test_regular_fields(self):
|
||||
"""
|
||||
Model fields should map to their equivalent serializer fields.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user