Skip to content

Commit 5c8abf7

Browse files
test(ApiHelper): add test cases for get_query_parameters utility (#97)
1 parent 0657a4b commit 5c8abf7

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

tests/apimatic_core/utility_tests/test_api_helper.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,4 +1169,17 @@ def test_update_entry_by_json_pointer(self, initial_dict, pointer, new_value, in
11691169

11701170
assert result == expected_dict
11711171
if not inplace:
1172-
assert initial_dict == original_copy
1172+
assert initial_dict == original_copy
1173+
1174+
@pytest.mark.parametrize("url, expected", [
1175+
(None, {}),
1176+
("https://example.com/path?name=Sufyan", {"name": "Sufyan"}),
1177+
("https://example.com/api?name=John&role=Engineer", {"name": "John", "role": "Engineer"}),
1178+
("https://example.com/home", {}),
1179+
("https://example.com/search?tag=python&tag=testing", {"tag": "testing"}), # last one wins
1180+
("https://example.com/?name=John%20Doe&role=Senior%20Engineer",
1181+
{"name": "John Doe", "role": "Senior Engineer"}),
1182+
("https://example.com/?debug=&verbose=true", {"verbose": "true"}),
1183+
])
1184+
def test_get_query_parameters(self, url, expected):
1185+
assert ApiHelper.get_query_parameters(url) == expected

0 commit comments

Comments
 (0)