mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-23 18:21:42 +08:00
Refactor make_module for tests
The original motivation for this refactor is to reuse make_module and drop TestMMDResolver._make_mmd. Some tests require a modulemd created and some tests also require those modulemd to be stored into database as a module build. The problem is db_session has to be passed to make_module even if no need to store into database. Major changes in this patch: * Argument db_session is optional. * Arguments requires_list and build_requires_list are replaced by a single argument dependencies which is a list of group of requires and buildrequires * A new make_module_in_db is created for creating and storing the new modulemd into database conveniently. * Tests are updated with the new make_module and make_module_in_db. Signed-off-by: Chenxiong Qi <cqi@redhat.com>
This commit is contained in:
@@ -42,9 +42,7 @@ class TestDBModule:
|
||||
|
||||
import_mmd(db_session, mmd)
|
||||
platform_f300103 = db_session.query(ModuleBuild).filter_by(stream="f30.1.3").one()
|
||||
mmd = tests.make_module(db_session,
|
||||
"testmodule:master:20170109091357:123",
|
||||
store_to_db=False)
|
||||
mmd = tests.make_module("testmodule:master:20170109091357:123")
|
||||
build = ModuleBuild(
|
||||
name="testmodule",
|
||||
stream="master",
|
||||
|
||||
@@ -380,7 +380,7 @@ class TestMBSModule:
|
||||
"version": 1,
|
||||
"context": "c1",
|
||||
"modulemd": mmd_to_str(
|
||||
tests.make_module(db_session, "nodejs:10:1:c1", store_to_db=False),
|
||||
tests.make_module("nodejs:10:1:c1"),
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -389,7 +389,7 @@ class TestMBSModule:
|
||||
"version": 2,
|
||||
"context": "c1",
|
||||
"modulemd": mmd_to_str(
|
||||
tests.make_module(db_session, "nodejs:10:2:c1", store_to_db=False),
|
||||
tests.make_module("nodejs:10:2:c1"),
|
||||
),
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user