tests-fix-1

This commit is contained in:
2025-08-27 02:45:15 +03:00
parent 90aece7a60
commit eef2ae1d5e
9 changed files with 413 additions and 115 deletions

View File

@@ -58,8 +58,47 @@ class TestCommunityDeleteE2EAPI:
print("✅ Сообщество найдено в базе")
print(f" ID: {test_community['id']}, Название: {test_community['name']}")
else:
print("⚠️ Сообщество не найдено, пропускаем тест...")
pytest.skip("Тестовое сообщество не найдено, пропускаем тест")
print("⚠️ Сообщество не найдено, создаем новое...")
# Создаем новое тестовое сообщество
create_response = requests.post(
f"{api_base_url}",
json={
"query": """
mutation CreateCommunity($input: CommunityInput!) {
create_community(input: $input) {
success
community {
id
name
slug
}
error
}
}
""",
"variables": {
"input": {
"name": "Test Community for Delete",
"slug": community_slug,
"desc": "Test community for deletion testing"
}
}
},
headers=headers,
timeout=10
)
if create_response.status_code == 200:
create_data = create_response.json()
if create_data.get("data", {}).get("create_community", {}).get("success"):
test_community = create_data["data"]["create_community"]["community"]
print(f"✅ Создано новое сообщество: {test_community['name']}")
else:
print("Не удалось создать тестовое сообщество")
pytest.skip("Не удалось создать тестовое сообщество")
else:
print("❌ Ошибка при создании сообщества")
pytest.skip("Ошибка API при создании сообщества")
except Exception as e:
print(f"❌ Ошибка при проверке сообщества: {e}")