From 12a702db0b19999579db3a7673a646283dca8cec Mon Sep 17 00:00:00 2001 From: "DESKTOP-10GD4VQ\\Sufyan" Date: Thu, 29 May 2025 15:50:52 +0500 Subject: [PATCH 1/2] test(ApiHelper): add test cases for get_query_parameters utility --- .../apimatic_core/utility_tests/test_api_helper.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/apimatic_core/utility_tests/test_api_helper.py b/tests/apimatic_core/utility_tests/test_api_helper.py index a47a644..912dd85 100644 --- a/tests/apimatic_core/utility_tests/test_api_helper.py +++ b/tests/apimatic_core/utility_tests/test_api_helper.py @@ -1169,4 +1169,16 @@ def test_update_entry_by_json_pointer(self, initial_dict, pointer, new_value, in assert result == expected_dict if not inplace: - assert initial_dict == original_copy \ No newline at end of file + assert initial_dict == original_copy + + @pytest.mark.parametrize("url, expected", [ + ("https://example.com/path?name=Sufyan", {"name": "Sufyan"}), + ("https://example.com/api?name=John&role=Engineer", {"name": "John", "role": "Engineer"}), + ("https://example.com/home", {}), + ("https://example.com/search?tag=python&tag=testing", {"tag": "testing"}), # last one wins + ("https://example.com/?name=John%20Doe&role=Senior%20Engineer", + {"name": "John Doe", "role": "Senior Engineer"}), + ("https://example.com/?debug=&verbose=true", {"verbose": "true"}), + ]) + def test_get_query_parameters(self, url, expected): + assert ApiHelper.get_query_parameters(url) == expected From 52f42ca191e1637b203ec0a2579563fa36c5fdfa Mon Sep 17 00:00:00 2001 From: "DESKTOP-10GD4VQ\\Sufyan" Date: Thu, 29 May 2025 15:53:39 +0500 Subject: [PATCH 2/2] adds edge case for None value --- tests/apimatic_core/utility_tests/test_api_helper.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/apimatic_core/utility_tests/test_api_helper.py b/tests/apimatic_core/utility_tests/test_api_helper.py index 912dd85..1886139 100644 --- a/tests/apimatic_core/utility_tests/test_api_helper.py +++ b/tests/apimatic_core/utility_tests/test_api_helper.py @@ -1172,6 +1172,7 @@ def test_update_entry_by_json_pointer(self, initial_dict, pointer, new_value, in assert initial_dict == original_copy @pytest.mark.parametrize("url, expected", [ + (None, {}), ("https://example.com/path?name=Sufyan", {"name": "Sufyan"}), ("https://example.com/api?name=John&role=Engineer", {"name": "John", "role": "Engineer"}), ("https://example.com/home", {}),