реализация 3 лабы

This commit is contained in:
Ванек
2026-10-29 14:51:19 +03:00
parent 74aa224251
commit 64ea89d040
28 changed files with 2411 additions and 243 deletions
+3
View File
@@ -2,6 +2,7 @@ from pathlib import Path
import sys
import unittest
from urllib.parse import urlencode
from uuid import uuid4
ROOT = Path(__file__).resolve().parents[1]
@@ -16,6 +17,8 @@ class ApiTestCase(unittest.TestCase):
self.path = "/api/v1/chats/" + self.chat["id"]
def assert_error(self, method, path, status, code, **kwargs):
if method == "POST" and path.endswith("/messages"):
kwargs["headers"] = {"Idempotency-Key": uuid4().hex, **kwargs.get("headers", {})}
result = self.client.call(method, path, status, **kwargs)
self.assertEqual(result["json"]["error"]["code"], code)
return result["json"]["error"]