diff --git a/.github/workflows/webviz.yml b/.github/workflows/webviz.yml index 7fc978f65..a18c1176d 100644 --- a/.github/workflows/webviz.yml +++ b/.github/workflows/webviz.yml @@ -95,6 +95,10 @@ jobs: - name: 🤖 Run tests working-directory: ./backend + env: + WEBVIZ_CLIENT_SECRET: 0 + WEBVIZ_SMDA_SUBSCRIPTION_KEY: 0 + WEBVIZ_SMDA_RESOURCE_SCOPE: 0 run: | pytest ./tests/unit diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 0fa36ebf5..79ef5ff27 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -54,4 +54,10 @@ max-branches = 14 [tool.mypy] ignore_missing_imports = true -disallow_untyped_defs = true \ No newline at end of file +disallow_untyped_defs = true + +[tool.pytest.ini_options] +pythonpath = ["."] +filterwarnings = "ignore::DeprecationWarning:pkg_resources" + + diff --git a/backend/src/backend/auth/auth_helper.py b/backend/src/backend/auth/auth_helper.py index 5b1315094..0dfc61c9a 100644 --- a/backend/src/backend/auth/auth_helper.py +++ b/backend/src/backend/auth/auth_helper.py @@ -11,7 +11,7 @@ from src.services.utils.authenticated_user import AuthenticatedUser from src.services.utils.perf_timer import PerfTimer -from src.backend import config +from src import config class AuthHelper: diff --git a/backend/src/backend/shared_middleware.py b/backend/src/backend/shared_middleware.py index a36cf975a..32a2bd3e3 100644 --- a/backend/src/backend/shared_middleware.py +++ b/backend/src/backend/shared_middleware.py @@ -2,10 +2,8 @@ from starsessions import SessionMiddleware from starsessions.stores.redis import RedisStore -from src.backend import config -from src.backend.auth.enforce_logged_in_middleware import ( - EnforceLoggedInMiddleware, -) +from src import config +from src.backend.auth.enforce_logged_in_middleware import EnforceLoggedInMiddleware def add_shared_middlewares(app: FastAPI) -> None: diff --git a/backend/src/backend/config.py b/backend/src/config.py similarity index 83% rename from backend/src/backend/config.py rename to backend/src/config.py index f5fd29cc2..894e9159c 100644 --- a/backend/src/backend/config.py +++ b/backend/src/config.py @@ -19,8 +19,6 @@ GRAPH_SCOPES = ["User.Read"] RESOURCE_SCOPES_DICT = { - # "sumo": [f"api://{sumo_app_reg['prod']['RESOURCE_ID']}/access_as_user"], - # Note that when switching back to prod, SUMO env in create_sumo_client_instance() must also be changed "sumo": [f"api://{sumo_app_reg[SUMO_ENV]['RESOURCE_ID']}/access_as_user"], "smda": [SMDA_RESOURCE_SCOPE], } diff --git a/backend/src/services/smda_access/queries/_get_request.py b/backend/src/services/smda_access/queries/_get_request.py index 6dd332132..5b8ad5af1 100644 --- a/backend/src/services/smda_access/queries/_get_request.py +++ b/backend/src/services/smda_access/queries/_get_request.py @@ -3,7 +3,7 @@ import requests from dotenv import load_dotenv -from src.backend import config +from src import config from src.services.utils.perf_timer import PerfTimer load_dotenv() diff --git a/backend/src/services/sumo_access/_helpers.py b/backend/src/services/sumo_access/_helpers.py index fa0cd8442..87d1198e7 100644 --- a/backend/src/services/sumo_access/_helpers.py +++ b/backend/src/services/sumo_access/_helpers.py @@ -1,11 +1,8 @@ -import os - from sumo.wrapper import SumoClient - -SUMO_ENV = os.getenv("WEBVIZ_SUMO_ENV", "dev") +from src import config def create_sumo_client_instance(access_token: str) -> SumoClient: - sumo_client = SumoClient(env=SUMO_ENV, token=access_token, interactive=False) + sumo_client = SumoClient(env=config.SUMO_ENV, token=access_token, interactive=False) return sumo_client