DDD Refactor: Use only init with object

This commit is contained in:
erik 2023-04-20 16:26:42 +02:00
parent b510314135
commit 066c874734

View file

@ -2,7 +2,7 @@ import pytest as pt
from pathlib import Path
from pybuilder.core import Project
from src.main.python.ddadevops.release_mixin import ReleaseMixin, create_release_mixin_config
from src.main.python.ddadevops.release_mixin import ReleaseMixin
from src.main.python.ddadevops.infrastructure.release_mixin import GitApi, EnvironmentApi
from src.main.python.ddadevops.domain import Devops, ReleaseConfig
@ -20,16 +20,6 @@ def change_test_dir( tmp_path: Path, monkeypatch: pt.MonkeyPatch):
class MyBuild(ReleaseMixin):
pass
def initialize(project, CONFIG_FILE):
project.build_depends_on('ddadevops>=3.1.2')
config = create_release_mixin_config(CONFIG_FILE, MAIN_BRANCH)
config.update({'stage': STAGE,
'module': MODULE,
'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)
@ -79,7 +69,7 @@ def test_release_mixin_environment(tmp_path: Path, monkeypatch: pt.MonkeyPatch):
environment_api = EnvironmentApi()
environment_api.set("DDADEVOPS_RELEASE_TYPE", "MAJOR")
build = initialize(project, th.TEST_FILE_PATH)
build = initialize_with_object(project, th.TEST_FILE_PATH)
build.prepare_release()
release_version = build.prepare_release_service.release_repo.version_repository.get_version()