File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 1+ from http import HTTPStatus
2+
13import allure
24
35from cart_api import CartAPI
46from open_ai_client import OpenAIClient
57import json
8+ from pytest_check import check
69
710
811class TestCase :
@@ -43,13 +46,13 @@ class TestCase:
4346 }
4447
4548 @allure .feature ('test_post_car_with_ai' )
46- def test_post_car_with_ai (self ):
49+ def test_post_cart_with_ai (self ):
4750 test_cases_str = self .open_ai_client .generate_api_test_cases (
4851 method = self .PROMPT ['method' ],
4952 api_path = self .PROMPT ['api_path' ],
5053 request_sample = self .PROMPT ['request_sample' ],
5154 response_sample = self .PROMPT ['response_sample' ],
52- max_cases_number = 2
55+ max_cases_number = 3
5356 )
5457 test_cases = self .open_ai_client .parse_ai_response (
5558 response_str = test_cases_str
@@ -69,4 +72,8 @@ def test_post_car_with_ai(self):
6972 products = input_data ['products' ]
7073 )
7174
72- assert resp .json () == expected_response
75+ assert resp .status_code == HTTPStatus .OK
76+ res = resp .json ()
77+ check .is_in ('userId' , res )
78+ if res ['products' ]:
79+ check .equal (res ['products' ][0 ]['title' ], input_data ['products' ][0 ]['title' ])
You can’t perform that action at this time.
0 commit comments