Add security requirements handling (#54)

* Add security requirements handling
* Update swagger-ui to 3.9.2, ReDoc to 1.20.0

Closes #39.
This commit is contained in:
Cristi Vîjdea
2018-01-23 12:43:25 +02:00
committed by GitHub
parent f18ff60ae7
commit fc35d9043e
21 changed files with 340 additions and 293 deletions
+3
View File
@@ -412,6 +412,7 @@ paths:
- application/json
tags:
- users
security: []
patch:
operationId: users_dummy
description: dummy operation
@@ -1123,3 +1124,5 @@ definitions:
securityDefinitions:
basic:
type: basic
security:
- basic: []
+12
View File
@@ -67,3 +67,15 @@ def test_no_netloc(mock_schema_request):
swagger = generator.get_schema(mock_schema_request, public=True)
assert 'host' not in swagger and 'schemes' not in swagger
assert swagger['info']['version'] == 'v2'
def test_securiy_requirements(swagger_settings, mock_schema_request):
generator = OpenAPISchemaGenerator(
info=openapi.Info(title="Test generator", default_version="v1"),
version="v2",
url='',
)
swagger_settings['SECURITY_REQUIREMENTS'] = []
swagger = generator.get_schema(mock_schema_request, public=True)
assert swagger['security'] == []