@@ -10,15 +10,20 @@ def test_output():
10
10
output_result_success = output (result_success )
11
11
12
12
# Verify that the output has the correct HTTP status code and payload
13
- assert output_result_success [0 ] == 200
14
- assert json .loads (output_result_success [1 ]) == {"message" : "Hello, world!" }
13
+ assert output_result_success [1 ] == 200
14
+ assert json .loads (output_result_success [0 ]) == {"message" : "Hello, world!" }
15
15
16
16
# Create a mock result object with an error status
17
- result_error = Result (status = "error" , errors = [" Invalid request" ])
17
+ result_error = Result (status = "error" , errors = [[ "param" , " Invalid request"] ])
18
18
19
19
# Call the output function with the mock result object
20
20
output_result_error = output (result_error )
21
21
22
22
# Verify that the output has the correct HTTP status code and payload
23
- assert output_result_error [0 ] == 400
24
- assert json .loads (output_result_error [1 ]) == ["Invalid request" ]
23
+ assert output_result_error [1 ] == 400
24
+ assert json .loads (output_result_error [0 ]) == [{"param" : "Invalid request" }]
25
+
26
+ def test_convert_to_hashes ():
27
+ input_arr = [["geo" , "missing geo parameters" ], ["app" , "missing geo parameters" ]]
28
+ expected_output_arr = [{'geo' : 'missing geo parameters' }, {'app' : 'missing geo parameters' }]
29
+ assert convert_to_hashes (input_arr ) == expected_output_arr
0 commit comments