forked from mtusi2026/mtusi2026lab3
реализация 3 лабы
This commit is contained in:
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user