Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Nov 10, 2023
1 parent a1fe3cc commit 635c851
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def test_api(config, api_, openapi):
assert isinstance(api_.config, dict)

req = mock_request(HTTP_ACCEPT='application/json')
rsp_headers, code, response = api_.openapi_(req, openapi)
rsp_headers, code, response = api_.openapi_(req)
assert rsp_headers['Content-Type'] == 'application/vnd.oai.openapi+json;version=3.0' # noqa
# No language requested: should be set to default from YAML
assert rsp_headers['Content-Language'] == 'en-US'
Expand All @@ -385,22 +385,22 @@ def test_api(config, api_, openapi):

a = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
req = mock_request(HTTP_ACCEPT=a)
rsp_headers, code, response = api_.openapi_(req, openapi)
rsp_headers, code, response = api_.openapi_(req)
assert rsp_headers['Content-Type'] == FORMAT_TYPES[F_HTML] == \
FORMAT_TYPES[F_HTML]

assert 'Swagger UI' in response

a = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
req = mock_request({'ui': 'redoc'}, HTTP_ACCEPT=a)
rsp_headers, code, response = api_.openapi_(req, openapi)
rsp_headers, code, response = api_.openapi_(req)
assert rsp_headers['Content-Type'] == FORMAT_TYPES[F_HTML] == \
FORMAT_TYPES[F_HTML]

assert 'ReDoc' in response

req = mock_request({'f': 'foo'})
rsp_headers, code, response = api_.openapi_(req, openapi)
rsp_headers, code, response = api_.openapi_(req)
assert rsp_headers['Content-Language'] == 'en-US'
assert code == HTTPStatus.BAD_REQUEST

Expand Down

0 comments on commit 635c851

Please sign in to comment.