mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-21 19:07:08 +00:00
[python] Encode list query params (#20148)
* Bugfix: #17688: Encode list query params * Test: #17688: Update validation error message tests for Pydantic 2.10+ Pydantic 2.10+ introduced changes to validation error messages, requiring updates to the affected test cases.
This commit is contained in:
@@ -294,3 +294,8 @@ class ApiClientTests(unittest.TestCase):
|
||||
params = self.api_client.parameters_to_url_query(params=[('list', [1, 2, 3])],
|
||||
collection_formats={'list': 'multi'})
|
||||
self.assertEqual(params, "list=1&list=2&list=3")
|
||||
|
||||
def test_parameters_to_url_query_list_value_encoded(self):
|
||||
params = self.api_client.parameters_to_url_query(params=[('list', [" !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "2023-01-01T00:00:00+01:00"])],
|
||||
collection_formats={'list': 'multi'})
|
||||
self.assertEqual(params, "list=%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-./%3A%3B%3C%3D%3E%3F%40%5B%5C%5D%5E_%60%7B%7C%7D~&list=2023-01-01T00%3A00%3A00%2B01%3A00")
|
||||
|
||||
@@ -50,7 +50,7 @@ class ApiExceptionTests(unittest.TestCase):
|
||||
try:
|
||||
self.pet_api.get_pet_by_id() # type: ignore
|
||||
except ValidationError as e:
|
||||
self.assertIn("1 validation error for get_pet_by_id", str(e))
|
||||
self.assertIn("1 validation error for PetApi.get_pet_by_id", str(e))
|
||||
self.assertIn("Missing required argument", str(e))
|
||||
|
||||
def test_integer_validation(self):
|
||||
@@ -61,7 +61,7 @@ class ApiExceptionTests(unittest.TestCase):
|
||||
# pet_id
|
||||
# Input should be a valid integer [type=int_type, input_value='123', input_type=str]
|
||||
# For further information visit https://errors.pydantic.dev/2.3/v/int_type
|
||||
self.assertIn("1 validation error for get_pet_by_id", str(e))
|
||||
self.assertIn("1 validation error for PetApi.get_pet_by_id", str(e))
|
||||
self.assertIn("Input should be a valid integer", str(e))
|
||||
|
||||
def test_string_enum_validation(self):
|
||||
|
||||
Reference in New Issue
Block a user