Exemplo n.º 1
0
 def test_set_request_obsolete(self, publish):
     req = DummyRequest(user=DummyUser())
     req.errors = cornice.Errors()
     eq_(self.obj.status, UpdateStatus.pending)
     self.obj.set_request(self.db, UpdateRequest.obsolete, req.user.name)
     eq_(self.obj.status, UpdateStatus.obsolete)
     eq_(len(req.errors), 0)
     publish.assert_called_once_with(topic='update.request.obsolete',
                                     msg=mock.ANY)
Exemplo n.º 2
0
 def test_set_request_untested_stable(self):
     """
     Ensure that we can't submit an update for stable if it hasn't met the
     minimum testing requirements.
     """
     req = DummyRequest(user=DummyUser())
     req.errors = cornice.Errors()
     req.koji = buildsys.get_session()
     eq_(self.obj.status, UpdateStatus.pending)
     try:
         self.obj.set_request(self.db, UpdateRequest.stable, req.user.name)
         assert False
     except BodhiException, e:
         pass
Exemplo n.º 3
0
    def test_set_request_stable_after_week_in_testing(self, publish):
        req = DummyRequest()
        req.errors = cornice.Errors()
        req.koji = buildsys.get_session()
        req.user = model.User(name='bob')

        self.obj.status = UpdateStatus.testing
        self.obj.request = None

        # Pretend it's been in testing for a week
        self.obj.comment(self.db,
                         u'This update has been pushed to testing.',
                         author=u'bodhi')
        self.obj.date_testing = self.obj.comments[-1].timestamp - timedelta(
            days=7)
        eq_(self.obj.days_in_testing, 7)
        eq_(self.obj.meets_testing_requirements, True)

        self.obj.set_request(self.db, UpdateRequest.stable, req)
        eq_(self.obj.request, UpdateRequest.stable)
        eq_(len(req.errors), 0)
        publish.assert_called_once_with(topic='update.request.stable',
                                        msg=mock.ANY)
Exemplo n.º 4
0
    def test_set_meets_then_met_requirements(self, publish):
        req = DummyRequest()
        req.errors = cornice.Errors()
        req.koji = buildsys.get_session()
        req.user = model.User(name='bob')

        self.obj.status = UpdateStatus.testing
        self.obj.request = None

        # Pretend it's been in testing for a week
        self.obj.comment(self.db,
                         u'This update has been pushed to testing.',
                         author=u'bodhi')
        self.obj.date_testing = self.obj.comments[-1].timestamp - timedelta(
            days=7)
        eq_(self.obj.days_in_testing, 7)
        eq_(self.obj.meets_testing_requirements, True)
        eq_(self.obj.met_testing_requirements, False)

        text = config.get('testing_approval_msg') % self.obj.days_in_testing
        self.obj.comment(self.db, text, author=u'bodhi')

        eq_(self.obj.meets_testing_requirements, True)
        eq_(self.obj.met_testing_requirements, True)