2
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
2026-10-16 19:49:48 +03:00
parent 65003b6119
commit c4ec287633
57 changed files with 4749 additions and 19 deletions
+24
View File
@@ -0,0 +1,24 @@
"""Общие помощники собственных тестов; переиспользуют публичный клиент tests/client.py (он не изменялся)."""
import base64
import os
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tests"))
from client import Client, Failure, check # noqa: E402,F401
BASE = os.environ.get("BASE_URL", "http://localhost:8080")
def client():
return Client(BASE)
def basic(username, password):
return {"Authorization": "Basic " + base64.b64encode((username + ":" + password).encode()).decode()}
def parse_json(response):
"""Публичный клиент парсит тело только при schema=...; для наших проверок нужен JSON всегда."""
import json
return json.loads(response["bytes"]) if response["bytes"] else None