fix c4k_mixin tests
This commit is contained in:
parent
55c9b7f2fd
commit
4bdbccd722
3 changed files with 8 additions and 6 deletions
|
@ -53,6 +53,9 @@ class DockerBuildService():
|
||||||
self.docker_api.test(build.name(), build.build_path())
|
self.docker_api.test(build.name(), build.build_path())
|
||||||
|
|
||||||
class C4kBuildService():
|
class C4kBuildService():
|
||||||
|
def __init__(self):
|
||||||
|
self.file_api = FileApi()
|
||||||
|
|
||||||
def write_c4k_config(self, c4k_build: C4kBuild):
|
def write_c4k_config(self, c4k_build: C4kBuild):
|
||||||
with open(c4k_build.build.build_path() + '/out_c4k_config.yaml', 'w', encoding="utf-8") as output_file:
|
with open(c4k_build.build.build_path() + '/out_c4k_config.yaml', 'w', encoding="utf-8") as output_file:
|
||||||
yaml.dump(c4k_build.c4k_mixin_config(), output_file)
|
yaml.dump(c4k_build.c4k_mixin_config(), output_file)
|
||||||
|
|
|
@ -29,14 +29,14 @@ def add_c4k_mixin_config(config,
|
||||||
|
|
||||||
class C4kMixin(DevopsBuild):
|
class C4kMixin(DevopsBuild):
|
||||||
def __init__(self, project, config):
|
def __init__(self, project, config):
|
||||||
self.build = C4kBuild(project, config)(project, config)
|
self.build = C4kBuild(project, config)
|
||||||
self.c4k_build_service = C4kBuildService()
|
self.c4k_build_service = C4kBuildService()
|
||||||
|
|
||||||
def write_c4k_config(self):
|
def write_c4k_config(self):
|
||||||
self.build_service.write_c4k_config(self.build)
|
self.c4k_build_service.write_c4k_config(self.build)
|
||||||
|
|
||||||
def write_c4k_auth(self):
|
def write_c4k_auth(self):
|
||||||
self.build_service.write_c4k_auth(self.build)
|
self.c4k_build_service.write_c4k_auth(self.build)
|
||||||
|
|
||||||
def c4k_apply(self, dry_run=False):
|
def c4k_apply(self, dry_run=False):
|
||||||
self.build_service.c4k_apply(self.build, dry_run)
|
self.c4k_build_service.c4k_apply(self.build, dry_run)
|
||||||
|
|
|
@ -24,10 +24,9 @@ def test_c4k_mixin(tmp_path):
|
||||||
config = {'a': 1, 'b': 2}
|
config = {'a': 1, 'b': 2}
|
||||||
auth = {'c': 3, 'd': 4}
|
auth = {'c': 3, 'd': 4}
|
||||||
|
|
||||||
add_c4k_mixin_config(project_config, module_name, config, auth, grafana_cloud_user='user', grafana_cloud_password='password')
|
add_c4k_mixin_config(project_config, config, auth, grafana_cloud_user='user', grafana_cloud_password='password')
|
||||||
|
|
||||||
assert project_config.get('C4kMixin') is not None
|
assert project_config.get('C4kMixin') is not None
|
||||||
assert project_config.get('C4kMixin').get('Name') is module_name
|
|
||||||
assert project_config.get('C4kMixin').get('Config') is config
|
assert project_config.get('C4kMixin').get('Config') is config
|
||||||
assert project_config.get('C4kMixin').get('Auth') is auth
|
assert project_config.get('C4kMixin').get('Auth') is auth
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue