Preserving the multiplicity of array type query parameters (#500)

* Preserving the multiplicity of array type query parameters

* Resolved failing tests, and refactored code block into a method

* Added tests for multi array

* Refactored parameter.py and updated tests in test_parameters.py
This commit is contained in:
Lance Hannestad
2017-09-08 06:18:47 -07:00
committed by Henning Jacobs
parent 08dd554ad3
commit f36c24685b
2 changed files with 26 additions and 1 deletions

View File

@@ -54,6 +54,14 @@ def test_array_query_param(simple_app):
response = app_client.get(url, headers=headers)
array_response = json.loads(response.data.decode('utf-8', 'replace')) # [str] unsupported collectionFormat
assert array_response == ["1;2;3"]
url = '/v1.0/test_array_csv_query_param?items=A&items=B&items=C&items=D,E,F'
response = app_client.get(url, headers=headers)
array_response = json.loads(response.data.decode('utf-8', 'replace')) # type: [str] multi array with csv format
assert array_response == ['A', 'B', 'C', 'D', 'E', 'F']
url = '/v1.0/test_array_pipes_query_param?items=4&items=5&items=6&items=7|8|9'
response = app_client.get(url, headers=headers)
array_response = json.loads(response.data.decode('utf-8', 'replace')) # type: [int] multi array with pipes format
assert array_response == [4, 5, 6, 7, 8, 9]
def test_extra_query_param(simple_app):