mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-11 04:19:36 +00:00
Fixes the build. Changes proposed in this pull request: - apply all of the isort changes that resulted from the latest version - pin to the latest version (4.3.15) so this doesn't happen again, unless we bump the version on purpose
29 lines
779 B
Python
29 lines
779 B
Python
# we are using "mock" module here for Py 2.7 support
|
|
from mock import MagicMock
|
|
|
|
from connexion.decorators.parameter import parameter_to_arg
|
|
|
|
|
|
def test_injection():
|
|
request = MagicMock(name='request', path_params={'p1': '123'})
|
|
request.args = {}
|
|
request.headers = {}
|
|
request.params = {}
|
|
|
|
func = MagicMock()
|
|
|
|
def handler(**kwargs):
|
|
func(**kwargs)
|
|
|
|
class Op(object):
|
|
consumes = ['application/json']
|
|
|
|
def get_arguments(self, *args, **kwargs):
|
|
return {"p1": "123"}
|
|
|
|
parameter_to_arg(Op(), handler)(request)
|
|
func.assert_called_with(p1='123')
|
|
|
|
parameter_to_arg(Op(), handler, pass_context_arg_name='framework_request_ctx')(request)
|
|
func.assert_called_with(p1='123', framework_request_ctx=request.context)
|