diff --git a/tests/functional/services/transfer/test_task_list.py b/tests/functional/services/transfer/test_task_list.py index 47dd7a159..4d4d3378a 100644 --- a/tests/functional/services/transfer/test_task_list.py +++ b/tests/functional/services/transfer/test_task_list.py @@ -27,3 +27,26 @@ def test_task_list(client, client_kwargs, qs): # parsed_qs will have each value as a list (because query-params are a multidict) # so transform the test data to match before comparison assert parsed_qs == {k: [v] for k, v in qs.items()} + + +@pytest.mark.parametrize( + "orderby_value, expected_orderby_param", + [ + ("foo", "foo"), + (["foo"], "foo"), + ("foo,bar", "foo,bar"), + ("foo ASC,bar", "foo ASC,bar"), + (["foo ASC", "bar"], "foo ASC,bar"), + (["foo ASC", "bar DESC"], "foo ASC,bar DESC"), + ], +) +def test_task_list_orderby_parameter(client, orderby_value, expected_orderby_param): + load_response(client.task_list) + client.task_list(orderby=orderby_value) + + req = get_last_request() + parsed_qs = urllib.parse.parse_qs(urllib.parse.urlparse(req.url).query) + assert "orderby" in parsed_qs + assert len(parsed_qs["orderby"]) == 1 + orderby_param = parsed_qs["orderby"][0] + assert orderby_param == expected_orderby_param