#2709 cli: mock-config error for non existing buildroot
Merged a year ago by tkopecek. Opened a year ago by jcupova.
jcupova/koji issue2642  into  master

@@ -948,6 +948,8 @@ 

          except ValueError:

              parser.error(_("Buildroot id must be an integer"))

          brootinfo = session.getBuildroot(br_id)

+         if brootinfo is None:

+             error(_("No such buildroot: %r") % br_id)

          if options.latest:

              opts['repoid'] = 'latest'

          else:

@@ -113,6 +113,16 @@ 

          gen_config_mock.assert_called_with(

              self.progname, buildroot_info['arch'], **opts)

  

+         # if buildroot is not existing

+         buildroot_id = '999999'

+         arguments = ['--buildroot', buildroot_id]

+         expected = "No such buildroot: %s" % buildroot_id + "\n"

+         session.getBuildroot.return_value = None

+         with self.assertRaises(SystemExit) as ex:

+             anon_handle_mock_config(options, session, arguments)

+         self.assertExitCode(ex, 1)

+         self.assert_console_message(stderr, expected)

+ 

      @mock.patch('sys.stderr', new_callable=six.StringIO)

      @mock.patch('sys.stdout', new_callable=six.StringIO)

      @mock.patch('koji.genMockConfig')

When buildroot is not existing, mock-config returns an error.

Fixes: https://pagure.io/koji/issue/2642

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

a year ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

a year ago

Commit cc35903 fixes this pull-request

Pull-Request has been merged by tkopecek

a year ago