From 88253f49ac3e587710ebf6c91e564172447e99b2 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 11 Aug 2023 14:20:27 +0200 Subject: [PATCH] use new api in release-service --- .../application/release_mixin_services.py | 11 +++++++++-- .../python/ddadevops/infrastructure/__init__.py | 1 + .../application/test_release_mixin_services.py | 3 ++- src/test/python/domain/helper.py | 14 ++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main/python/ddadevops/application/release_mixin_services.py b/src/main/python/ddadevops/application/release_mixin_services.py index f686c3f..f9aeb53 100644 --- a/src/main/python/ddadevops/application/release_mixin_services.py +++ b/src/main/python/ddadevops/application/release_mixin_services.py @@ -1,18 +1,25 @@ from typing import List from pathlib import Path -from ..infrastructure import GitApi, BuildFileRepository +from ..infrastructure import GitApi, ArtifactDeploymentApi, BuildFileRepository from ..domain import Version, Release, ReleaseType class ReleaseService: - def __init__(self, git_api: GitApi, build_file_repository: BuildFileRepository): + def __init__( + self, + git_api: GitApi, + build_file_repository: BuildFileRepository, + artifact_deployment_api: ArtifactDeploymentApi, + ): self.git_api = git_api + self.artifact_deployment_api = artifact_deployment_api self.build_file_repository = build_file_repository @classmethod def prod(cls, base_dir: str): return cls( GitApi(), + ArtifactDeploymentApi(), BuildFileRepository(base_dir), ) diff --git a/src/main/python/ddadevops/infrastructure/__init__.py b/src/main/python/ddadevops/infrastructure/__init__.py index 1bb11b5..1a520ed 100644 --- a/src/main/python/ddadevops/infrastructure/__init__.py +++ b/src/main/python/ddadevops/infrastructure/__init__.py @@ -7,5 +7,6 @@ from .infrastructure import ( CredentialsApi, GitApi, TerraformApi, + ArtifactDeploymentApi, ) from .repository import DevopsRepository, BuildFileRepository diff --git a/src/test/python/application/test_release_mixin_services.py b/src/test/python/application/test_release_mixin_services.py index 40f6553..b6fbe02 100644 --- a/src/test/python/application/test_release_mixin_services.py +++ b/src/test/python/application/test_release_mixin_services.py @@ -7,12 +7,13 @@ from src.main.python.ddadevops.domain import ( from src.test.python.domain.helper import ( BuildFileRepositoryMock, GitApiMock, + ArtifactDeploymentApiMock, build_devops, ) from src.main.python.ddadevops.application import ReleaseService def test_sould_update_release_type(): - sut = ReleaseService(GitApiMock(), BuildFileRepositoryMock("build.py")) + sut = ReleaseService(GitApiMock(), ArtifactDeploymentApiMock(), BuildFileRepositoryMock("build.py")) devops = build_devops({}) release = devops.mixins[MixinType.RELEASE] sut.update_release_type(release, "MAJOR") diff --git a/src/test/python/domain/helper.py b/src/test/python/domain/helper.py index 05161d0..74a67d5 100644 --- a/src/test/python/domain/helper.py +++ b/src/test/python/domain/helper.py @@ -150,3 +150,17 @@ class GitApiMock: def checkout(self, branch: str): pass + + +class ArtifactDeploymentApiMock: + def __init__(self): + pass + + def post_release(self, target_url: str, tag: str, token: str): + pass + + def post_asset(self, target_url: str, release_id: str, attachment: str, attachment_type: str, token: str): + pass + + def calculate_checksums(self, build_path: str): + pass