add api testing (#14)
* add fixture to make api calls with authentification * add authentik test that checks the status of all blueprints * add option to append any kind of data to html report Reviewed-on: local-it-infrastructure/e2e_tests#14 Co-authored-by: Daniel <d.brummerloh@gmail.com> Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
parent
d1ff1183a5
commit
873bf73ae8
8 changed files with 89 additions and 19 deletions
|
|
@ -5,18 +5,16 @@ import os
|
|||
import re
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
from typing import Protocol, TypedDict
|
||||
from typing import Generator, Protocol, TypedDict
|
||||
|
||||
import pytest
|
||||
from dotenv import dotenv_values
|
||||
from icecream import ic
|
||||
from icecream import ic # type: ignore
|
||||
from imbox import Imbox # type: ignore
|
||||
from playwright.sync_api import BrowserContext, expect
|
||||
from playwright.sync_api import APIRequestContext, BrowserContext, Playwright, expect
|
||||
from pytest import Parser
|
||||
|
||||
from pytest_abra.dir_manager import DirManager
|
||||
from pytest_abra.env_manager import EnvFile
|
||||
from pytest_abra.utils import BaseUrl
|
||||
from pytest_abra import BaseUrl, DirManager, EnvFile
|
||||
|
||||
|
||||
def pytest_addoption(parser: Parser):
|
||||
|
|
@ -152,3 +150,14 @@ 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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue