various (#16)
* add full integration test of cli / pytest_abra with all tests * save path of runner_*.py in runner subclass to improve test discovery -> allows for same test name in two different runners * reorganize output dir names * use URL fixture everywhere * rework coordinator interface * add --session_id to cli args * add log results table * plenty of refactoring * add assert messages * add plenty of tests * add /docs dir with plenty of documentation * fix authentik setup * add authentik cleanup, remove test user * add random test user credential generation and integrate into test routine. random creds are saved to STATES Reviewed-on: local-it-infrastructure/e2e_tests#16 Co-authored-by: Daniel <d.brummerloh@gmail.com> Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
parent
016b88a68d
commit
2dd765a974
36 changed files with 1145 additions and 432 deletions
54
tests/test_cli.py
Normal file
54
tests/test_cli.py
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import re
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from pytest_abra import DirManager
|
||||
from pytest_abra.utils import get_session_id
|
||||
|
||||
|
||||
def test_get_session_id_random(tmp_path: Path):
|
||||
args_output_dir = tmp_path
|
||||
args_resume = False
|
||||
args_session_id = None
|
||||
session_id = get_session_id(args_output_dir, args_resume, args_session_id)
|
||||
assert re.search(r"\d+-\d+-\d+", session_id)
|
||||
|
||||
|
||||
def test_get_session_id_explicit1(tmp_path: Path):
|
||||
args_output_dir = tmp_path
|
||||
args_resume = False
|
||||
args_session_id = "abc"
|
||||
session_id = get_session_id(args_output_dir, args_resume, args_session_id)
|
||||
assert session_id == "abc"
|
||||
|
||||
|
||||
def test_get_session_id_explicit2(tmp_path: Path):
|
||||
args_output_dir = tmp_path
|
||||
args_resume = True
|
||||
args_session_id = "abc"
|
||||
session_id = get_session_id(args_output_dir, args_resume, args_session_id)
|
||||
assert session_id == "abc"
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_get_session_id_integration(tmp_path: Path):
|
||||
assert len(list(tmp_path.iterdir())) == 0
|
||||
session_id_1 = get_session_id(args_output_dir=tmp_path, args_resume=False, args_session_id=None)
|
||||
|
||||
DIR = DirManager(output_dir=tmp_path, session_id=session_id_1)
|
||||
DIR.create_all_dirs()
|
||||
assert len(list(tmp_path.iterdir())) == 1
|
||||
|
||||
time.sleep(1.1) # get_session_id won't be unique if called without time passed
|
||||
session_id_2 = get_session_id(args_output_dir=tmp_path, args_resume=False, args_session_id=None)
|
||||
DIR = DirManager(output_dir=tmp_path, session_id=session_id_2)
|
||||
DIR.create_all_dirs()
|
||||
assert len(list(tmp_path.iterdir())) == 2
|
||||
|
||||
session_id_3 = get_session_id(args_output_dir=tmp_path, args_resume=True, args_session_id=None)
|
||||
assert session_id_2 == session_id_3
|
||||
|
||||
session_id_4 = get_session_id(args_output_dir=tmp_path, args_resume=True, args_session_id="abc")
|
||||
assert session_id_4 == "abc"
|
||||
Loading…
Add table
Add a link
Reference in a new issue