25 lines
719 B
Python
25 lines
719 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
from pytest_abra.coordinator import Coordinator
|
|
from pytest_abra.dir_manager import DirManager
|
|
|
|
|
|
def test_load_test_credentials(tmp_path: Path):
|
|
assert "TEST_USER" not in os.environ
|
|
|
|
DIR = DirManager(output_dir=tmp_path, session_id="abc")
|
|
DIR.create_all_dirs()
|
|
|
|
Coordinator.load_test_credentials(DIR)
|
|
assert (DIR.STATES / "credentials_test.json").is_file()
|
|
|
|
assert "TEST_USER" in os.environ
|
|
test_user_before = os.environ["TEST_USER"]
|
|
|
|
# os.environ.clear() # this breaks pytest!
|
|
del os.environ["TEST_USER"]
|
|
assert "TEST_USER" not in os.environ
|
|
|
|
Coordinator.load_test_credentials(DIR)
|
|
assert test_user_before == os.environ["TEST_USER"]
|