|
|
|
@ -3,7 +3,7 @@ from pathlib import Path
|
|
|
|
|
from pybuilder.core import Project
|
|
|
|
|
|
|
|
|
|
from src.main.python.ddadevops.release_mixin.release_mixin import ReleaseMixin, create_release_mixin_config
|
|
|
|
|
from src.main.python.ddadevops.release_mixin.infrastructure_api import GitApi
|
|
|
|
|
from src.main.python.ddadevops.release_mixin.infrastructure_api import GitApi, EnvironmentApi
|
|
|
|
|
|
|
|
|
|
from .helper import Helper
|
|
|
|
|
|
|
|
|
@ -29,7 +29,7 @@ def initialize(project, CONFIG_FILE):
|
|
|
|
|
build = MyBuild(project, config)
|
|
|
|
|
return build
|
|
|
|
|
|
|
|
|
|
def test_release_mixin(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
|
|
|
|
def test_release_mixin_git(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
|
|
|
|
|
|
|
|
|
# init
|
|
|
|
|
th = Helper()
|
|
|
|
@ -51,3 +51,32 @@ def test_release_mixin(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
|
|
|
|
|
|
|
|
|
# test
|
|
|
|
|
assert "124.0.1-SNAPSHOT" in release_version.get_version_string()
|
|
|
|
|
|
|
|
|
|
def test_release_mixin_environment(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
|
|
|
|
|
|
|
|
|
# init
|
|
|
|
|
th = Helper()
|
|
|
|
|
th.copy_files(th.TEST_FILE_PATH, tmp_path)
|
|
|
|
|
th.TEST_FILE_PATH = tmp_path / th.TEST_FILE_NAME
|
|
|
|
|
|
|
|
|
|
change_test_dir(tmp_path, monkeypatch)
|
|
|
|
|
project = Project(tmp_path)
|
|
|
|
|
|
|
|
|
|
git_api = GitApi()
|
|
|
|
|
git_api.init()
|
|
|
|
|
git_api.set_user_config("ex.ample@mail.com", "Ex Ample")
|
|
|
|
|
git_api.add_file(th.TEST_FILE_NAME)
|
|
|
|
|
git_api.commit("Commit Message")
|
|
|
|
|
|
|
|
|
|
environment_api = EnvironmentApi()
|
|
|
|
|
environment_api.set("DDADEVOPS_RELEASE_TYPE", "MAJOR")
|
|
|
|
|
|
|
|
|
|
build = initialize(project, th.TEST_FILE_PATH)
|
|
|
|
|
build.prepare_release()
|
|
|
|
|
release_version = build.version_repo.get_version()
|
|
|
|
|
|
|
|
|
|
# test
|
|
|
|
|
assert "124.0.1-SNAPSHOT" in release_version.get_version_string()
|
|
|
|
|
|
|
|
|
|
# tear down
|
|
|
|
|
environment_api.set("DDADEVOPS_RELEASE_TYPE", "")
|
|
|
|
|