From de9ef27b3f7f06dca45b5a8de00ffcc8f613485a Mon Sep 17 00:00:00 2001 From: Dominic Cleal Date: Wed, 11 May 2016 17:53:24 +0100 Subject: [PATCH] Only pass one project_name to copr build command --- src/tito/release/copr.py | 6 +++--- test/functional/release_copr_tests.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/tito/release/copr.py b/src/tito/release/copr.py index bf25312..cf19989 100644 --- a/src/tito/release/copr.py +++ b/src/tito/release/copr.py @@ -79,7 +79,7 @@ class CoprReleaser(KojiReleaser): if self.remote_location: path = self.remote_location + os.path.basename(srpm_location) self._upload(srpm_location) - self._submit(path) + self._submit(path, tag) def _upload(self, srpm_location): if self.srpm_submitted: @@ -99,9 +99,9 @@ class CoprReleaser(KojiReleaser): print(run_command(cmd_upload)) self.srpm_submitted = srpm_location - def _submit(self, srpm_location): + def _submit(self, srpm_location, project): cmd_submit = "/usr/bin/%s build %s %s %s" % \ - (self.cli_tool, self.copr_options, self.releaser_config.get(self.target, "project_name"), srpm_location) + (self.cli_tool, self.copr_options, project, srpm_location) if self.dry_run: self.print_dry_run_warning(cmd_submit) return diff --git a/test/functional/release_copr_tests.py b/test/functional/release_copr_tests.py index 5f56495..ebcaaef 100644 --- a/test/functional/release_copr_tests.py +++ b/test/functional/release_copr_tests.py @@ -84,3 +84,17 @@ class CoprReleaserTests(TitoGitTestFixture): self.assertFalse(upload.called) self.assertTrue(submit.called) + + @mock.patch("tito.release.CoprReleaser._run_command") + def test_multiple_project_names(self, run_command): + self.releaser_config.remove_option("test", "remote_location") + self.releaser_config.set('test', 'project_name', "%s %s" % (PKG_NAME, + PKG_NAME)) + releaser = CoprReleaser(PKG_NAME, None, '/tmp/tito/', + self.config, {}, 'test', self.releaser_config, False, + False, False, **{'offline': True}) + releaser.release() + args = mock.call('/usr/bin/copr-cli build --nowait releaseme %s' % + releaser.builder.srpm_location) + self.assertEquals(args, run_command.mock_calls[0]) + self.assertEquals(args, run_command.mock_calls[1])