Fix mmd.copy calls to support PackagerV3

Fixes #1685
This commit is contained in:
Brendan Reilly
2021-03-08 14:24:45 -05:00
parent 8f0e35abe4
commit d0579a16c1
5 changed files with 129 additions and 38 deletions

View File

@@ -300,6 +300,36 @@ class TestUtilsComponentReuse:
assert username_arg == username
rmtree(module_dir)
@mock.patch("module_build_service.web.submit.submit_module_build")
def test_submit_module_build_from_yaml_packager_v3(self, mock_submit):
"""
Tests local module build from a yaml file with the skiptests option
Args:
mock_submit (MagickMock): mocked function submit_module_build, which we then
inspect if it was called with correct arguments
"""
module_dir = tempfile.mkdtemp()
modulemd_yaml = read_staged_data("v3/mmd_packager")
modulemd_file_path = path.join(module_dir, "testmodule.yaml")
username = "test"
stream = "dev"
with io.open(modulemd_file_path, "w", encoding="utf-8") as fd:
fd.write(modulemd_yaml)
with open(modulemd_file_path, "rb") as fd:
handle = FileStorage(fd)
submit_module_build_from_yaml(
db_session, username, handle, {}, stream=stream, skiptests=False)
mock_submit_args = mock_submit.call_args[0]
username_arg = mock_submit_args[1]
mmd_arg = mock_submit_args[2]
assert mmd_arg.get_stream_name() == stream
assert username_arg == username
rmtree(module_dir)
@mock.patch("module_build_service.web.submit.generate_expanded_mmds")
def test_submit_build_new_mse_build(self, generate_expanded_mmds):
"""