Use EnvironmentKeys, refactor in test accordingly
This commit is contained in:
parent
f51afe8bbc
commit
3776116383
2 changed files with 9 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
from .domain import Release, Version, ReleaseType
|
from .domain import Release, Version, ReleaseType, EnvironmentKeys
|
||||||
from .infrastructure_api import FileHandler, GitApi, EnvironmentApi
|
from .infrastructure_api import FileHandler, GitApi, EnvironmentApi
|
||||||
|
|
||||||
class VersionRepository():
|
class VersionRepository():
|
||||||
|
@ -60,7 +60,7 @@ class ReleaseTypeRepository():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __get_release_type_environment(self) -> ReleaseType | None:
|
def __get_release_type_environment(self) -> ReleaseType | None:
|
||||||
release_name = self.environment_api.get('RELEASE_TYPE')
|
release_name = self.environment_api.get(EnvironmentKeys.DDADEVOPS_RELEASE_TYPE.name)
|
||||||
|
|
||||||
if release_name is None:
|
if release_name is None:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -54,27 +54,27 @@ def test_release_type_repository_git():
|
||||||
assert release_type == None
|
assert release_type == None
|
||||||
|
|
||||||
def test_release_type_repository_env():
|
def test_release_type_repository_env():
|
||||||
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'RELEASE_TYPE': 'MINOR test'}))
|
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'DDADEVOPS_RELEASE_TYPE': 'MINOR test'}))
|
||||||
release_type = sut.get_release_type()
|
release_type = sut.get_release_type()
|
||||||
assert release_type is ReleaseType.MINOR
|
assert release_type is ReleaseType.MINOR
|
||||||
|
|
||||||
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'RELEASE_TYPE': 'MINOR'}))
|
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'DDADEVOPS_RELEASE_TYPE': 'MINOR'}))
|
||||||
release_type = sut.get_release_type()
|
release_type = sut.get_release_type()
|
||||||
assert release_type is ReleaseType.MINOR
|
assert release_type is ReleaseType.MINOR
|
||||||
|
|
||||||
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'RELEASE_TYPE': 'Major bla'}))
|
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'DDADEVOPS_RELEASE_TYPE': 'Major bla'}))
|
||||||
release_type = sut.get_release_type()
|
release_type = sut.get_release_type()
|
||||||
assert release_type == ReleaseType.MAJOR
|
assert release_type == ReleaseType.MAJOR
|
||||||
|
|
||||||
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'RELEASE_TYPE': 'Patch bla'}))
|
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'DDADEVOPS_RELEASE_TYPE': 'Patch bla'}))
|
||||||
release_type = sut.get_release_type()
|
release_type = sut.get_release_type()
|
||||||
assert release_type == ReleaseType.PATCH
|
assert release_type == ReleaseType.PATCH
|
||||||
|
|
||||||
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'RELEASE_TYPE': 'Snapshot bla'}))
|
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'DDADEVOPS_RELEASE_TYPE': 'Snapshot bla'}))
|
||||||
release_type = sut.get_release_type()
|
release_type = sut.get_release_type()
|
||||||
assert release_type == ReleaseType.SNAPSHOT
|
assert release_type == ReleaseType.SNAPSHOT
|
||||||
|
|
||||||
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'RELEASE_TYPE': 'Random text'}))
|
sut = ReleaseTypeRepository.from_environment(MockEnvironmentApi({'DDADEVOPS_RELEASE_TYPE': 'Random text'}))
|
||||||
release_type = sut.get_release_type()
|
release_type = sut.get_release_type()
|
||||||
assert release_type == None
|
assert release_type == None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue