fix tests

This commit is contained in:
Michael Jerger 2023-03-09 20:24:11 +01:00
parent a94a7ea62b
commit f7668231be
4 changed files with 9 additions and 9 deletions

View file

@ -30,7 +30,7 @@ def add_c4k_mixin_config(config,
class C4kMixin(DevopsBuild): class C4kMixin(DevopsBuild):
def __init__(self, project, config): def __init__(self, project, config):
super().__init__(project, config) super().__init__(project, config)
self.c4k_build = C4kBuild(project, config) self.c4k_build = C4kBuild(self.build, project, config)
self.c4k_build_service = C4kBuildService() self.c4k_build_service = C4kBuildService()
def write_c4k_config(self): def write_c4k_config(self):

View file

@ -48,7 +48,7 @@ class Build(Validateable):
def __get_keys__(self, keys): def __get_keys__(self, keys):
result = {} result = {}
for key in keys: for key in keys:
result[key] = self.get(key) result[key] = self.__get__(key)
return result return result
@ -69,8 +69,8 @@ class DockerBuild(Validateable):
class C4kBuild(Validateable): class C4kBuild(Validateable):
def __init__(self, project, config): def __init__(self, build: Build, project, config):
self.build = Build(project, config) self.build = build
self.c4k_mixin_config = config["C4kMixin"]["Config"] self.c4k_mixin_config = config["C4kMixin"]["Config"]
self.c4k_mixin_auth = config["C4kMixin"]["Auth"] self.c4k_mixin_auth = config["C4kMixin"]["Auth"]
tmp = self.c4k_mixin_config["mon-cfg"] tmp = self.c4k_mixin_config["mon-cfg"]

View file

@ -37,11 +37,11 @@ def test_c4k_mixin(tmp_path):
mixin.build.update_runtime_config('test.de', None, None) mixin.build.update_runtime_config('test.de', None, None)
mixin.write_c4k_config() mixin.write_c4k_config()
assert 'fqdn' in mixin.c4k_mixin_config assert 'fqdn' in mixin.c4k_build.config()
assert 'mon-cfg' in mixin.c4k_mixin_config assert 'mon-cfg' in mixin.c4k_build.config()
assert os.path.exists(f'{mixin.build_path()}/out_c4k_config.yaml') assert os.path.exists(f'{mixin.build_path()}/out_c4k_config.yaml')
mixin.write_c4k_auth() mixin.write_c4k_auth()
assert 'mon-auth' in mixin.c4k_mixin_auth assert 'mon-auth' in mixin.c4k_build.c4k_mixin_auth
assert os.path.exists(f'{mixin.build_path()}/out_c4k_auth.yaml') assert os.path.exists(f'{mixin.build_path()}/out_c4k_auth.yaml')

View file

@ -1,5 +1,5 @@
from pybuilder.core import Project from pybuilder.core import Project
from src.main.python.ddadevops.domain import Validateable, C4kBuild from src.main.python.ddadevops.domain import Validateable, C4kBuild, Build
from src.main.python.ddadevops.c4k_mixin import add_c4k_mixin_config from src.main.python.ddadevops.c4k_mixin import add_c4k_mixin_config
@ -62,7 +62,7 @@ def test_c4k_build_should_update_fqdn(tmp_path):
grafana_cloud_user="user", grafana_cloud_user="user",
grafana_cloud_password="password", grafana_cloud_password="password",
) )
sut = C4kBuild(project, project_config) sut = C4kBuild(Build(project, project_config), project, project_config)
sut.update_runtime_config('test.de', None, None) sut.update_runtime_config('test.de', None, None)
assert { assert {