unit tests

This commit is contained in:
Mike McLean
2021-03-10 12:55:04 -05:00
parent 2115d54030
commit 8b15bcaf94
3 changed files with 76 additions and 1 deletions

View File

@@ -99,6 +99,33 @@ class TestDBModule:
"testmodule", "master", "20170109091357", "78e4a6fd").keys()
assert set(result) == expected
@pytest.mark.parametrize("missing_format", [False, True])
def test_get_module_build_dependencies_side_tag(
self, missing_format, reuse_component_init_data):
"""
Test that we get the correct base module tag when a side tag is specified
"""
platform = models.ModuleBuild.get_by_id(db_session, 1)
module = models.ModuleBuild.get_by_id(db_session, 2)
mmd = module.mmd()
xmd = mmd.get_xmd()
side_tag = "SIDETAG"
expected = {"module-f28-SIDETAG-build"}
xmd["mbs"]["side_tag"] = side_tag
mmd.set_xmd(xmd)
if missing_format:
# remove koji_tag_format from our platform
platform_mmd = platform.mmd()
platform_xmd = platform_mmd.get_xmd()
del platform_xmd["mbs"]["koji_side_tag_format"]
platform_mmd.set_xmd(platform_xmd)
platform.modulemd = mmd_to_str(mmd)
db_session.commit()
expected = {"module-f28-build"}
resolver = mbs_resolver.GenericResolver.create(db_session, conf, backend="db")
result = resolver.get_module_build_dependencies(mmd=mmd).keys()
assert set(result) == expected
def test_get_module_build_dependencies_recursive(self, reuse_component_init_data):
"""
Tests that the buildrequires are returned when it is two layers deep