Skip to content

Commit

Permalink
add regression test #217
Browse files Browse the repository at this point in the history
  • Loading branch information
tfranzel committed Dec 14, 2020
1 parent 9f3ff37 commit e43ad2a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,20 @@ def view_func(request, format=None):
view_func.cls.authentication_classes = [CustomTokenAuthentication]

schema = generate_schema('x', view_function=view_func)
validate_schema(schema)

assert schema['components']['securitySchemes']['tokenAuth']['scheme'] == 'bearer'


@pytest.mark.parametrize('responses', [
str,
OpenApiTypes.STR,
{'200': str},
{'200': OpenApiTypes.STR},
])
def test_string_response_variations(no_warnings, responses):
@extend_schema(responses=responses)
@api_view(['GET'])
def view_func(request, format=None):
pass # pragma: no cover

schema = generate_schema('x', view_function=view_func)
assert get_response_schema(schema['paths']['/x']['get'])['type'] == 'string'

0 comments on commit e43ad2a

Please sign in to comment.