use new api in release-service
This commit is contained in:
parent
2fc59f105b
commit
88253f49ac
4 changed files with 26 additions and 3 deletions
|
@ -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),
|
||||
)
|
||||
|
||||
|
|
|
@ -7,5 +7,6 @@ from .infrastructure import (
|
|||
CredentialsApi,
|
||||
GitApi,
|
||||
TerraformApi,
|
||||
ArtifactDeploymentApi,
|
||||
)
|
||||
from .repository import DevopsRepository, BuildFileRepository
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue