Skip to content

Commit

Permalink
fix: Pass custom keyword arguments to client.get in the from_wsgi
Browse files Browse the repository at this point in the history
… loader

To match the behavior of `from_uri`. They should be the same, since they contact the application under test
  • Loading branch information
Stranger6667 committed Apr 14, 2020
1 parent d34ec2b commit b0e21e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/changelog.rst
Expand Up @@ -10,6 +10,7 @@ Fixed
~~~~~

- Support for custom loaders in ``runner``. Now all built-in loaders are supported as an argument to ``runner.prepare``. `#496`_
- ``from_wsgi`` loader accept custom keyword arguments that will be passed to ``client.get`` when accessing the schema. `#497`_

`1.1.1`_ - 2020-04-12
---------------------
Expand Down Expand Up @@ -897,6 +898,7 @@ Fixed
.. _0.3.0: https://github.com/kiwicom/schemathesis/compare/v0.2.0...v0.3.0
.. _0.2.0: https://github.com/kiwicom/schemathesis/compare/v0.1.0...v0.2.0

.. _#497: https://github.com/kiwicom/schemathesis/issues/497
.. _#496: https://github.com/kiwicom/schemathesis/issues/496
.. _#489: https://github.com/kiwicom/schemathesis/issues/489
.. _#473: https://github.com/kiwicom/schemathesis/issues/473
Expand Down
3 changes: 2 additions & 1 deletion src/schemathesis/loaders.py
Expand Up @@ -171,8 +171,9 @@ def from_wsgi(
validate_schema: bool = True,
**kwargs: Any,
) -> BaseSchema:
kwargs.setdefault("headers", {}).setdefault("User-Agent", USER_AGENT)
client = Client(app, WSGIResponse)
response = client.get(schema_path, headers={"User-Agent": USER_AGENT})
response = client.get(schema_path, **kwargs)
# Raising exception to provide unified behavior
# E.g. it will be handled in CLI - a proper error message will be shown
if 400 <= response.status_code < 600:
Expand Down

0 comments on commit b0e21e2

Please sign in to comment.