Merge branch 'dev' into feature/auth-internal

This commit is contained in:
Untone 2025-05-22 00:24:06 +03:00
commit 32bc1276e0
6 changed files with 26 additions and 9 deletions

2
pyproject.toml Normal file
View File

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

19
pyrightconfig.json Normal file
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 @pytest.fixture
def frontend_url() -> str: def frontend_url() -> str:
"""URL фронтенда для тестов""" """URL фронтенда для тестов"""
return "http://localhost:3000" return "https://localhost:3000"
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)

View File

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

View File

@ -1,6 +1,6 @@
"""Тестовые настройки для OAuth""" """Тестовые настройки для OAuth"""
FRONTEND_URL = "http://localhost:3000" FRONTEND_URL = "https://localhost:3000"
OAUTH_CLIENTS = { OAUTH_CLIENTS = {
"GOOGLE": {"id": "test_google_id", "key": "test_google_secret"}, "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 assert response.status_code == 200
data = response.json() data = response.json()
assert "error" not in data assert "error" not in data
assert ( assert data["data"]["create_reaction"]["reaction"]["kind"] == ReactionKind.LIKE.value
data["data"]["create_reaction"]["reaction"]["kind"] == ReactionKind.LIKE.value
)