add one more test
This commit is contained in:
parent
e0239d7f08
commit
9445cf6b5f
3 changed files with 32 additions and 10 deletions
|
@ -70,15 +70,21 @@ def build_devops(
|
|||
|
||||
|
||||
class BuildFileRepositoryMock:
|
||||
def get(self, path: Path) -> BuildFile:
|
||||
return BuildFile(
|
||||
Path("./package.json"),
|
||||
"""
|
||||
def __init__(self, file_name=None):
|
||||
if file_name:
|
||||
self.file_path = Path(f"./src/test/resources/{file_name}")
|
||||
with open(self.file_path, "r", encoding="utf-8") as input_file:
|
||||
self.content = input_file.read()
|
||||
else:
|
||||
self.file_path = Path("./package.json")
|
||||
self.content = """
|
||||
{
|
||||
"version": "1.1.5-SNAPSHOT"
|
||||
}
|
||||
""",
|
||||
)
|
||||
"""
|
||||
|
||||
def get(self, path: Path) -> BuildFile:
|
||||
return BuildFile(self.file_path, self.content)
|
||||
|
||||
def write(self, build_file: BuildFile):
|
||||
pass
|
||||
|
|
|
@ -101,18 +101,19 @@ from pybuilder.core import init, use_plugin, Author
|
|||
use_plugin("python.core")
|
||||
|
||||
name = "ddadevops"
|
||||
version = "1.1.5-dev"
|
||||
version = "1.1.5-dev12"
|
||||
summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
|
||||
""",
|
||||
)
|
||||
assert sut.get_version() == Version.from_str("1.1.5-dev")
|
||||
assert sut.get_version() == Version.from_str("1.1.5-dev12")
|
||||
|
||||
sut = BuildFile(
|
||||
Path("./build.py"),
|
||||
"""
|
||||
version = "1.1.5-dev1"
|
||||
version = "1.1.5-dev12"
|
||||
""",
|
||||
)
|
||||
sut.set_version(Version.from_str("1.1.5-dev1").create_major())
|
||||
sut.set_version(Version.from_str("1.1.5-dev12").create_major())
|
||||
assert '\nversion = "2.0.0"\n' == sut.content
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,21 @@ def test_should_load_build_file():
|
|||
== sut.initialize(devops_config({})).mixins[MixinType.RELEASE].version
|
||||
)
|
||||
|
||||
sut = InitService(
|
||||
DevopsFactory(),
|
||||
BuildFileRepositoryMock("build.py"),
|
||||
CredentialsApiMock({
|
||||
"server/meissa/grafana-cloud:grafana-cloud-user": "gopass-gfc-user",
|
||||
"server/meissa/grafana-cloud": "gopass-gfc-password",
|
||||
}),
|
||||
EnvironmentApiMock({}),
|
||||
GitApiMock(),
|
||||
)
|
||||
assert (
|
||||
Version.from_str("4.0.0-dev73")
|
||||
== sut.initialize(devops_config({})).mixins[MixinType.RELEASE].version
|
||||
)
|
||||
|
||||
|
||||
def test_should_resolve_passwords():
|
||||
sut = InitService(
|
||||
|
|
Loading…
Reference in a new issue