Implement test for EnvironmentApi()

This commit is contained in:
erik 2023-04-11 15:03:01 +02:00
parent 6ede2528c2
commit 012a04115a

View file

@ -1,7 +1,7 @@
from pathlib import Path from pathlib import Path
import pytest as pt import pytest as pt
from src.main.python.ddadevops.release_mixin.infrastructure_api import GitApi from src.main.python.ddadevops.release_mixin.infrastructure_api import GitApi, EnvironmentApi
from src.main.python.ddadevops.release_mixin.infrastructure import VersionRepository from src.main.python.ddadevops.release_mixin.infrastructure import VersionRepository
from src.main.python.ddadevops.release_mixin.domain import ReleaseType from src.main.python.ddadevops.release_mixin.domain import ReleaseType
@ -10,6 +10,16 @@ from .helper import Helper
def change_test_dir( tmp_path: Path, monkeypatch: pt.MonkeyPatch): def change_test_dir( tmp_path: Path, monkeypatch: pt.MonkeyPatch):
monkeypatch.chdir(tmp_path) monkeypatch.chdir(tmp_path)
def test_environment_api():
# init
env_api = EnvironmentApi()
key = "TEST_ENV_KEY"
value = "data"
env_api.set(key, value)
#test
assert env_api.get(key) == value
def test_git_api(tmp_path: Path, monkeypatch: pt.MonkeyPatch): def test_git_api(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
# init # init
th = Helper() th = Helper()