From 7bbb847eb190d61ce23b52e2d3bc4ffcf60f32c3 Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 16 May 2025 09:22:53 +0300 Subject: [PATCH] tests, maintainance fixes --- app/resolvers/draft.py | 1 - pyproject.toml | 2 ++ resolvers/pyrightconfig.json | 25 ------------------------- services/pyrightconfig.json | 19 +++++++++++++++++++ tests/auth/conftest.py | 2 +- tests/auth/test_oauth.py | 6 ++---- tests/auth/test_settings.py | 2 +- tests/test_reactions.py | 4 +--- 8 files changed, 26 insertions(+), 35 deletions(-) delete mode 100644 app/resolvers/draft.py create mode 100644 pyproject.toml delete mode 100644 resolvers/pyrightconfig.json create mode 100644 services/pyrightconfig.json diff --git a/app/resolvers/draft.py b/app/resolvers/draft.py deleted file mode 100644 index 0519ecba..00000000 --- a/app/resolvers/draft.py +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..a00f05cd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.ruff] +line-length = 108 diff --git a/resolvers/pyrightconfig.json b/resolvers/pyrightconfig.json deleted file mode 100644 index c3d0f5cf..00000000 --- a/resolvers/pyrightconfig.json +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/services/pyrightconfig.json b/services/pyrightconfig.json new file mode 100644 index 00000000..cd9d6e99 --- /dev/null +++ b/services/pyrightconfig.json @@ -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 +} diff --git a/tests/auth/conftest.py b/tests/auth/conftest.py index e60f5ceb..ef795214 100644 --- a/tests/auth/conftest.py +++ b/tests/auth/conftest.py @@ -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) diff --git a/tests/auth/test_oauth.py b/tests/auth/test_oauth.py index d6b77247..cd558c29 100644 --- a/tests/auth/test_oauth.py +++ b/tests/auth/test_oauth.py @@ -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) diff --git a/tests/auth/test_settings.py b/tests/auth/test_settings.py index 8d8313e2..2361d224 100644 --- a/tests/auth/test_settings.py +++ b/tests/auth/test_settings.py @@ -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"}, diff --git a/tests/test_reactions.py b/tests/test_reactions.py index 32dd625e..147984d4 100644 --- a/tests/test_reactions.py +++ b/tests/test_reactions.py @@ -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