Refactor tests to accomodate changes
This commit is contained in:
parent
84d3e29c28
commit
a1f9992fba
2 changed files with 13 additions and 5 deletions
|
@ -4,6 +4,7 @@ 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, EnvironmentApi
|
||||
from src.main.python.ddadevops.domain import Devops, ReleaseConfig
|
||||
|
||||
from .helper import Helper
|
||||
|
||||
|
@ -27,6 +28,13 @@ def initialize(project, CONFIG_FILE):
|
|||
'project_root_path': PROJECT_ROOT_PATH,
|
||||
'build_dir_name': BUILD_DIR_NAME})
|
||||
build = MyBuild(project, config)
|
||||
return build
|
||||
|
||||
def initialize_with_object(project, CONFIG_FILE):
|
||||
project.build_depends_on('ddadevops>=3.1.2')
|
||||
devops = Devops(STAGE, PROJECT_ROOT_PATH, MODULE, "release_test", BUILD_DIR_NAME)
|
||||
release_config = ReleaseConfig(MAIN_BRANCH, CONFIG_FILE, devops)
|
||||
build = MyBuild(project, release_config=release_config)
|
||||
return build
|
||||
|
||||
def test_release_mixin_git(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
||||
|
@ -45,9 +53,9 @@ def test_release_mixin_git(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
|||
git_api.add_file(th.TEST_FILE_NAME)
|
||||
git_api.commit("MAJOR release")
|
||||
|
||||
build = initialize(project, th.TEST_FILE_PATH)
|
||||
build = initialize_with_object(project, th.TEST_FILE_PATH)
|
||||
build.prepare_release()
|
||||
release_version = build.version_repo.get_version()
|
||||
release_version = build.prepare_release_service.release_repo.version_repository.get_version()
|
||||
|
||||
# test
|
||||
assert "124.0.1-SNAPSHOT" in release_version.get_version_string()
|
||||
|
@ -73,7 +81,7 @@ def test_release_mixin_environment(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
|
|||
|
||||
build = initialize(project, th.TEST_FILE_PATH)
|
||||
build.prepare_release()
|
||||
release_version = build.version_repo.get_version()
|
||||
release_version = build.prepare_release_service.release_repo.version_repository.get_version()
|
||||
|
||||
# test
|
||||
assert "124.0.1-SNAPSHOT" in release_version.get_version_string()
|
||||
|
|
|
@ -30,8 +30,8 @@ def test_prepare_release_service(): # todo: maybe use mocks for service api test
|
|||
def test_tag_and_push_release_service():
|
||||
# init
|
||||
mock_release_repo = MockReleaseRepository(MockVersionRepository(), MockReleaseTypeRepository(MockGitApi()), 'main')
|
||||
tag_and_push_release_service = TagAndPushReleaseService(MockGitApi())
|
||||
tag_and_push_release_service.tag_release(mock_release_repo.get_release())
|
||||
tag_and_push_release_service = TagAndPushReleaseService(MockGitApi(), mock_release_repo)
|
||||
tag_and_push_release_service.tag_release()
|
||||
tag_and_push_release_service.push_release()
|
||||
|
||||
#test
|
||||
|
|
Loading…
Reference in a new issue