|
|
@ -1,7 +1,7 @@
|
|
|
|
import pytest
|
|
|
|
import pytest
|
|
|
|
from pathlib import Path
|
|
|
|
from pathlib import Path
|
|
|
|
from src.main.python.ddadevops.domain import (
|
|
|
|
from src.main.python.ddadevops.domain import (
|
|
|
|
ReleaseType,
|
|
|
|
ReleaseType,
|
|
|
|
MixinType,
|
|
|
|
MixinType,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
from src.test.python.domain.helper import (
|
|
|
|
from src.test.python.domain.helper import (
|
|
|
@ -12,8 +12,11 @@ from src.test.python.domain.helper import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
from src.main.python.ddadevops.application import ReleaseService
|
|
|
|
from src.main.python.ddadevops.application import ReleaseService
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_sould_update_release_type():
|
|
|
|
def test_sould_update_release_type():
|
|
|
|
sut = ReleaseService(GitApiMock(), ArtifactDeploymentApiMock(), BuildFileRepositoryMock("build.py"))
|
|
|
|
sut = ReleaseService(
|
|
|
|
|
|
|
|
GitApiMock(), ArtifactDeploymentApiMock(), BuildFileRepositoryMock("build.py")
|
|
|
|
|
|
|
|
)
|
|
|
|
devops = build_devops({})
|
|
|
|
devops = build_devops({})
|
|
|
|
release = devops.mixins[MixinType.RELEASE]
|
|
|
|
release = devops.mixins[MixinType.RELEASE]
|
|
|
|
sut.update_release_type(release, "MAJOR")
|
|
|
|
sut.update_release_type(release, "MAJOR")
|
|
|
@ -21,3 +24,19 @@ def test_sould_update_release_type():
|
|
|
|
|
|
|
|
|
|
|
|
with pytest.raises(Exception):
|
|
|
|
with pytest.raises(Exception):
|
|
|
|
sut.update_release_type(release, "NOT_EXISTING")
|
|
|
|
sut.update_release_type(release, "NOT_EXISTING")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_sould_publish_artifacts():
|
|
|
|
|
|
|
|
mock = ArtifactDeploymentApiMock(release='{"id": 2345}')
|
|
|
|
|
|
|
|
sut = ReleaseService(GitApiMock(), mock, BuildFileRepositoryMock())
|
|
|
|
|
|
|
|
devops = build_devops(
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"release_artifacts": ["target/art"],
|
|
|
|
|
|
|
|
"release_artifact_server_url": "http://repo.test/",
|
|
|
|
|
|
|
|
"release_organisation": "orga",
|
|
|
|
|
|
|
|
"release_repository_name": "repo",
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
release = devops.mixins[MixinType.RELEASE]
|
|
|
|
|
|
|
|
sut.publish_artifacts(release)
|
|
|
|
|
|
|
|
assert 2345 == mock.add_asset_to_release_id
|
|
|
|