Skip to content

Commit

Permalink
Add failing test for optional header
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgf committed Sep 11, 2020
1 parent 1ed14fb commit b3f1a71
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/api/test_headers.py
Expand Up @@ -42,3 +42,10 @@ def test_no_content_object_and_have_headers(simple_app):
resp = app_client.get('/v1.0/test-204-with-headers-nocontent-obj')
assert resp.status_code == 204
assert 'X-Something' in resp.headers


def test_optional_header(simple_openapi_app):
app_client = simple_openapi_app.app.test_client()
resp = app_client.get('/v1.0/test-optional-headers')
assert resp.status_code == 200
assert 'X-Optional-Header' not in resp.headers
4 changes: 4 additions & 0 deletions tests/fakeapi/hello/__init__.py
Expand Up @@ -602,3 +602,7 @@ def get_date():

def get_uuid():
return {'value': uuid.UUID(hex='e7ff66d0-3ec2-4c4e-bed0-6e4723c24c51')}


def test_optional_headers():
return {}, 200
18 changes: 18 additions & 0 deletions tests/fixtures/simple/openapi.yaml
Expand Up @@ -1140,6 +1140,24 @@ paths:
application/json:
schema:
type: object
/test-optional-headers:
get:
operationId: fakeapi.hello.test_optional_headers
responses:
'200':
description: Some object response
content:
application/json:
schema:
type: object
headers:
X-Optional-Header:
description: Optional header
schema:
type: string
required: False



servers:
- url: http://localhost:{port}/{basePath}
Expand Down

0 comments on commit b3f1a71

Please sign in to comment.