This commit is contained in:
@@ -5,7 +5,6 @@ E2E тесты для админ-панели с реальными HTTP зап
|
||||
import pytest
|
||||
import requests
|
||||
import json
|
||||
import time
|
||||
|
||||
|
||||
@pytest.mark.e2e
|
||||
@@ -15,6 +14,17 @@ def test_admin_panel_login_and_access_e2e(api_base_url, auth_headers, test_user_
|
||||
|
||||
print("🚀 Начинаем E2E тест админ-панели через API с тестовой БД")
|
||||
|
||||
# 🔍 Получаем данные созданного тестового пользователя
|
||||
created_user = create_test_users_in_backend_db
|
||||
if not created_user.get("created", False):
|
||||
pytest.skip(f"Не удалось создать тестового пользователя: {created_user.get('error', 'Unknown error')}")
|
||||
|
||||
# Используем данные созданного пользователя
|
||||
user_credentials = {
|
||||
"email": created_user["email"],
|
||||
"password": created_user["password"]
|
||||
}
|
||||
|
||||
# 1. Авторизуемся через API
|
||||
login_mutation = """
|
||||
mutation Login($email: String!, $password: String!) {
|
||||
@@ -31,11 +41,11 @@ def test_admin_panel_login_and_access_e2e(api_base_url, auth_headers, test_user_
|
||||
}
|
||||
"""
|
||||
|
||||
print("🔐 Авторизуемся через GraphQL API...")
|
||||
print(f"🔐 Авторизуемся через GraphQL API с пользователем: {user_credentials['email']}")
|
||||
try:
|
||||
response = requests.post(
|
||||
api_base_url,
|
||||
json={"query": login_mutation, "variables": test_user_credentials},
|
||||
json={"query": login_mutation, "variables": user_credentials},
|
||||
headers=auth_headers(),
|
||||
timeout=10
|
||||
)
|
||||
@@ -240,6 +250,17 @@ def test_admin_panel_user_management_e2e(api_base_url, auth_headers, test_user_c
|
||||
|
||||
print("🚀 Начинаем E2E тест управления пользователями через API с тестовой БД")
|
||||
|
||||
# 🔍 Получаем данные созданного тестового пользователя
|
||||
created_user = create_test_users_in_backend_db
|
||||
if not created_user.get("created", False):
|
||||
pytest.skip(f"Не удалось создать тестового пользователя: {created_user.get('error', 'Unknown error')}")
|
||||
|
||||
# Используем данные созданного пользователя
|
||||
user_credentials = {
|
||||
"email": created_user["email"],
|
||||
"password": created_user["password"]
|
||||
}
|
||||
|
||||
# 1. Авторизуемся
|
||||
login_mutation = """
|
||||
mutation Login($email: String!, $password: String!) {
|
||||
@@ -256,11 +277,11 @@ def test_admin_panel_user_management_e2e(api_base_url, auth_headers, test_user_c
|
||||
}
|
||||
"""
|
||||
|
||||
print("🔐 Авторизуемся...")
|
||||
print(f"🔐 Авторизуемся с пользователем: {user_credentials['email']}")
|
||||
try:
|
||||
response = requests.post(
|
||||
api_base_url,
|
||||
json={"query": login_mutation, "variables": test_user_credentials},
|
||||
json={"query": login_mutation, "variables": user_credentials},
|
||||
headers=auth_headers(),
|
||||
timeout=10
|
||||
)
|
||||
@@ -376,6 +397,17 @@ def test_admin_panel_community_management_e2e(api_base_url, auth_headers, test_u
|
||||
|
||||
print("🚀 Начинаем E2E тест управления сообществом через API с тестовой БД")
|
||||
|
||||
# 🔍 Получаем данные созданного тестового пользователя
|
||||
created_user = create_test_users_in_backend_db
|
||||
if not created_user.get("created", False):
|
||||
pytest.skip(f"Не удалось создать тестового пользователя: {created_user.get('error', 'Unknown error')}")
|
||||
|
||||
# Используем данные созданного пользователя
|
||||
user_credentials = {
|
||||
"email": created_user["email"],
|
||||
"password": created_user["password"]
|
||||
}
|
||||
|
||||
# 1. Авторизуемся
|
||||
login_mutation = """
|
||||
mutation Login($email: String!, $password: String!) {
|
||||
@@ -392,11 +424,11 @@ def test_admin_panel_community_management_e2e(api_base_url, auth_headers, test_u
|
||||
}
|
||||
"""
|
||||
|
||||
print("🔐 Авторизуемся...")
|
||||
print(f"🔐 Авторизуемся с пользователем: {user_credentials['email']}")
|
||||
try:
|
||||
response = requests.post(
|
||||
api_base_url,
|
||||
json={"query": login_mutation, "variables": test_user_credentials},
|
||||
json={"query": login_mutation, "variables": user_credentials},
|
||||
headers=auth_headers(),
|
||||
timeout=10
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user