Skip to content
Myr

testing: Make json a keyword arg

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Markus Unterwaditzer · committed by Markus Unterwaditzer · parent 8661183 · Browse files · 1 file+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:flask/testing.py+3 added-3 removed
19 unmodified lines
20except ImportError:21 from urlparse import urlsplit as url_parse222324def make_test_environ_builder(app, path='/', base_url=None, json=None, *args, **kwargs):24def make_test_environ_builder(app, path='/', base_url=None, *args, **kwargs):25 """Creates a new test builder with some application defaults thrown in."""26 http_host = app.config.get('SERVER_NAME')27 app_root = app.config.get('APPLICATION_ROOT')28 if base_url is None:
5 unmodified lines
34 path = url.path35 if url.query:36 path += '?' + url.query3738 if json is not None:38 if 'json' in kwargs:39 if 'data' in kwargs:40 raise ValueError('Client cannot provide both `json` and `data`')41 kwargs['data'] = json_dumps(json)41 kwargs['data'] = json_dumps(kwargs['json'])4243 # Only set Content-Type when not explicitly provided44 if 'content_type' not in kwargs:45 kwargs['content_type'] = 'application/json'
95 unmodified lines