Skip to content

Commit

Permalink
bugfix wrong DIST setting in Redoc #546
Browse files Browse the repository at this point in the history
  • Loading branch information
tfranzel committed Oct 3, 2021
1 parent 4a2dd5f commit 8a3a459
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drf_spectacular/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,4 @@ def get(self, request, *args, **kwargs):
def _redoc_dist(self):
if spectacular_settings.REDOC_DIST == 'SIDECAR':
return _get_sidecar_url('redoc')
return spectacular_settings.SWAGGER_UI_DIST
return spectacular_settings.REDOC_DIST
3 changes: 3 additions & 0 deletions tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,16 @@ def test_spectacular_view_accept_unknown(no_warnings):
@pytest.mark.parametrize('ui', ['redoc', 'swagger-ui'])
@pytest.mark.urls(__name__)
def test_spectacular_ui_view(no_warnings, ui):
from drf_spectacular.settings import spectacular_settings
response = APIClient().get(f'/api/v2/schema/{ui}/')
assert response.status_code == 200
assert response.content.startswith(b'<!DOCTYPE html>')
if ui == 'redoc':
assert b'<title>ReDoc</title>' in response.content
assert spectacular_settings.REDOC_DIST.encode() in response.content
else:
assert b'<title>Swagger</title>' in response.content
assert spectacular_settings.SWAGGER_UI_DIST.encode() in response.content
assert b'"/api/v2/schema/"' in response.content


Expand Down

0 comments on commit 8a3a459

Please sign in to comment.