test/builder: check a successful compose

Use the standard session and options mock object together with the
new composer mock object to simulate a successful compose:
the mock composer will accept the request and also status calls
for it, which will immediately return with success. The plugin
should then return and indicate a successful compose.
This commit is contained in:
Christian Kellner 2020-09-15 18:05:27 +02:00
parent 31885efab8
commit e1edb12d11

View file

@ -234,3 +234,26 @@ class TestBuilderPlugin(PluginTest):
with self.assertRaises(koji.GenericError):
handler.handler(*args)
@httpretty.activate
def test_compose_success(self):
# Simulate a successful compose, check return value
session = self.mock_session()
options = self.mock_options()
handler = self.plugin.OSBuildImage(1,
"osbuildImage",
"params",
session,
options)
args = ["name", "version", "distro",
["image_type"],
"fedora-candidate",
["x86_64"],
{}]
composer = MockComposer(architectures=["x86_64"])
composer.httpretty_regsiter()
res = handler.handler(*args)
assert res, "invalid compose result"