Files
connexion/tests/decorators/test_parameter.py
Daniel Grossmann-Kavanagh 08e4536e5e bump and pin isort, apply all automatic fixes (#903)
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
2019-03-15 13:04:33 +01:00

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)