tests, maintainance fixes
All checks were successful
Deploy on push / deploy (push) Successful in 1m36s

This commit is contained in:
Untone 2025-05-16 09:22:53 +03:00
parent 8a60bec73a
commit 7bbb847eb1
8 changed files with 26 additions and 35 deletions

View File

@ -1 +0,0 @@

2
pyproject.toml Normal file
View File

@ -0,0 +1,2 @@
[tool.ruff]
line-length = 108

View File

@ -1,25 +0,0 @@
{
"include": [
"."
],
"exclude": [
"**/node_modules",
"**/__pycache__",
"**/.*"
],
"defineConstant": {
"DEBUG": true
},
"venvPath": ".",
"venv": ".venv",
"pythonVersion": "3.11",
"typeCheckingMode": "strict",
"reportMissingImports": true,
"reportMissingTypeStubs": false,
"reportUnknownMemberType": false,
"reportUnknownParameterType": false,
"reportUnknownVariableType": false,
"reportUnknownArgumentType": false,
"reportPrivateUsage": false,
"reportUntypedFunctionDecorator": false
}

View File

@ -0,0 +1,19 @@
{
"include": ["."],
"exclude": ["**/node_modules", "**/__pycache__", "**/.*"],
"defineConstant": {
"DEBUG": true
},
"venvPath": ".",
"venv": ".venv",
"pythonVersion": "3.11",
"typeCheckingMode": "strict",
"reportMissingImports": true,
"reportMissingTypeStubs": false,
"reportUnknownMemberType": false,
"reportUnknownParameterType": false,
"reportUnknownVariableType": false,
"reportUnknownArgumentType": false,
"reportPrivateUsage": false,
"reportUntypedFunctionDecorator": false
}

View File

@ -15,7 +15,7 @@ def oauth_settings() -> Dict[str, Dict[str, str]]:
@pytest.fixture
def frontend_url() -> str:
"""URL фронтенда для тестов"""
return "http://localhost:3000"
return "https://localhost:3000"
@pytest.fixture(autouse=True)

View File

@ -6,7 +6,7 @@ from auth.oauth import get_user_profile, oauth_login, oauth_callback
# Подменяем настройки для тестов
with (
patch("auth.oauth.FRONTEND_URL", "http://localhost:3000"),
patch("auth.oauth.FRONTEND_URL", "https://localhost:3000"),
patch(
"auth.oauth.OAUTH_CLIENTS",
{
@ -208,9 +208,7 @@ with (
# Мокаем существующего пользователя
existing_user = MagicMock()
session = MagicMock()
session.query.return_value.filter.return_value.first.return_value = (
existing_user
)
session.query.return_value.filter.return_value.first.return_value = existing_user
mock_session.return_value.__enter__.return_value = session
response = await oauth_callback(mock_request)

View File

@ -1,6 +1,6 @@
"""Тестовые настройки для OAuth"""
FRONTEND_URL = "http://localhost:3000"
FRONTEND_URL = "https://localhost:3000"
OAUTH_CLIENTS = {
"GOOGLE": {"id": "test_google_id", "key": "test_google_secret"},

View File

@ -65,6 +65,4 @@ async def test_create_reaction(test_client, db_session, test_setup):
assert response.status_code == 200
data = response.json()
assert "error" not in data
assert (
data["data"]["create_reaction"]["reaction"]["kind"] == ReactionKind.LIKE.value
)
assert data["data"]["create_reaction"]["reaction"]["kind"] == ReactionKind.LIKE.value