zhongjiajie commented on code in PR #130:
URL:
https://github.com/apache/dolphinscheduler-sdk-python/pull/130#discussion_r1443697106
##########
tests/tasks/test_http.py:
##########
@@ -126,3 +129,79 @@ def test_http_get_define():
):
http = Http(name, url)
assert http.task_params == expect_task_params
+
+
+def test_http_params_conversion():
+ # Create a sample http_params dictionary
+ http_params_dict = {
+ "prop1": "value1",
+ "prop2": 135,
+ "prop3": "value3"
+ }
+
+ # Create an instance of the Http class with http_params as a dictionary
+ http = Http(
+ name="test_http",
+ url="http://www.example.com",
+ http_method="GET",
+ http_params=http_params_dict
+ )
+
+
+ # Add any assertions or additional tests as required based on your
project's logic
+ assert isinstance(http_instance.http_params, list)
+ assert len(http_instance.http_params) == len(http_params_dict)
+
+def test_http_params_transformation():
+ """Test the transformation of http_params."""
+
+ # Create a sample http_params dictionary with varied value types
+ http_params_dict = {
+ "prop1": "value1",
+ "prop2": 135, # Changed this value to an integer as suggested
+ "prop3": "value3"
+ }
+
+ # Create an instance of the Http class with http_params as a dictionary
+ http_instance = Http(
+ name="test_http",
+ url="http://www.example.com",
+ http_method="GET",
+ http_params=http_params_dict
+ )
+
+ # Expected transformation after applying the changes
+ expect = [
+ {"prop": "prop1", "direct": "IN", "type": "VARCHAR", "value":
"value1"},
Review Comment:
Hi, we can merge test function `test_http_params_transformation` and
`test_http_params_conversion` into single one
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]