add test_helper for improved testing & fix devops_test

This commit is contained in:
Michael Jerger 2023-04-28 18:07:55 +02:00
parent 63409f03a9
commit 1da73523d9
2 changed files with 10 additions and 4 deletions

View file

@ -1,10 +1,9 @@
import pytest
from .test_helper import build_devops
from src.main.python.ddadevops.domain.common import (
Devops,
)
def test_devops_buildpath():
sut = Devops(
stage="test", project_root_path="../../..", module="cloud", name="meissa"
)
sut = build_devops({'module': "cloud", 'name': "meissa"})
assert "../../../target/meissa/cloud" == sut.build_path()

View file

@ -3,7 +3,14 @@ from src.main.python.ddadevops.domain import (
)
def build_devops(overrides: dict) -> Devops:
default = {}
default = {'build_type': 'IMAGE',
'stage': 'test',
'project_root_path': "../../..",
'name': 'mybuild',
'module': 'test_image',
'dockerhub_user': 'dockerhub_user',
'dockerhub_password': 'dockerhub_password',
'docker_image_tag': 'docker_image_tag',}
input = default.copy()
input.update(overrides)
return DevopsFactory().build_devops(input)