Skip to content

Commit 41d92b7

Browse files
committed
test_post_cart_with_ai pytest check
1 parent a82df03 commit 41d92b7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test_cart_api.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
from http import HTTPStatus
2+
13
import allure
24

35
from cart_api import CartAPI
46
from open_ai_client import OpenAIClient
57
import json
8+
from pytest_check import check
69

710

811
class 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'])

0 commit comments

Comments
 (0)