Skip to content

Commit

Permalink
Merge pull request #8 from sjaensch/fix-construct-request-boolean-hea…
Browse files Browse the repository at this point in the history
…der-test

Fix test failures related to boolean param handling in bravado-core 5.0.5
  • Loading branch information
sjaensch committed Aug 8, 2018
2 parents 0171ca6 + 9e0a034 commit d9936a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion testing/integration_server.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import argparse
import asyncio
import os.path
Expand All @@ -20,7 +21,7 @@ async def login(request):
if not (
request.query.get('username') == 'asyncio'
and request.query.get('password') == 'password'
and request.query.get('invalidate_sessions') == 'True'
and request.query.get('invalidate_sessions') in ('True', 'true')
):
return web.HTTPBadRequest()

Expand Down
8 changes: 7 additions & 1 deletion tests/client/construct_request_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ def test_with_not_string_headers(
'files': mock.Mock(),
})

assert request['headers'][header_name] == str(header_value)
expected_header_value = str(header_value)
# we need to handle a backwards-incompatible change in bravado-core 5.0.5
if swagger_type == 'boolean':
assert request['headers'][header_name] in (expected_header_value, expected_header_value.lower())
else:
assert request['headers'][header_name] == expected_header_value

unmarshalled_request = unmarshal_request(request_object, operation)
assert unmarshalled_request[header_name] == header_value

Expand Down

0 comments on commit d9936a4

Please sign in to comment.