From 0d6bd2d0f87290aa8da20d388994b82354a68383 Mon Sep 17 00:00:00 2001 From: Daniel Brummerloh Date: Wed, 13 Dec 2023 17:00:56 +0100 Subject: [PATCH] move fixtures --- pytest_abra/custom_fixtures.py | 13 +------------ recipes/authentik/tests_authentik/conftest.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 recipes/authentik/tests_authentik/conftest.py diff --git a/pytest_abra/custom_fixtures.py b/pytest_abra/custom_fixtures.py index 5aa86d6..0f0a5f0 100644 --- a/pytest_abra/custom_fixtures.py +++ b/pytest_abra/custom_fixtures.py @@ -12,7 +12,7 @@ import pytest from dotenv import dotenv_values from icecream import ic # type: ignore from imbox import Imbox # type: ignore -from playwright.sync_api import APIRequestContext, BrowserContext, Playwright, expect +from playwright.sync_api import BrowserContext, expect from pytest import Parser from pytest_abra import BaseUrl, DirManager, EnvFile @@ -150,14 +150,3 @@ def imap_recent_messages(imap_client: Imbox) -> list[Message]: messages.append(message) return messages - - -@pytest.fixture(scope="session") -def api_request_context( - playwright: Playwright, - DIR: DirManager, -) -> Generator[APIRequestContext, None, None]: - state_file = DIR.STATES / "authentik_admin_state.json" - request_context = playwright.request.new_context(storage_state=state_file) - yield request_context - request_context.dispose() diff --git a/recipes/authentik/tests_authentik/conftest.py b/recipes/authentik/tests_authentik/conftest.py new file mode 100644 index 0000000..6542c21 --- /dev/null +++ b/recipes/authentik/tests_authentik/conftest.py @@ -0,0 +1,17 @@ +from typing import Generator + +import pytest +from playwright.sync_api import APIRequestContext, Playwright + +from pytest_abra import DirManager + + +@pytest.fixture(scope="session") +def api_request_context( + playwright: Playwright, + DIR: DirManager, +) -> Generator[APIRequestContext, None, None]: + state_file = DIR.STATES / "authentik_admin_state.json" + request_context = playwright.request.new_context(storage_state=state_file) + yield request_context + request_context.dispose()