def test_recycle_building(self): new = self.new.copy() old = self.old.copy() old['state'] = new['state'] = koji.BUILD_STATES['BUILDING'] old['task_id'] = new['task_id'] = 137 kojihub.recycle_build(old, new) self.UpdateProcessor.assert_not_called() self.QueryProcessor.assert_not_called() self._dml.assert_not_called() self.run_callbacks.assert_not_called()
def run_fail(self, old, new): try: kojihub.recycle_build(old, new) except koji.GenericError: pass else: raise Exception("expected koji.GenericError") self.UpdateProcessor.assert_not_called() self._dml.assert_not_called() self.run_callbacks.assert_not_called()
def run_pass(self, old, new): kojihub.recycle_build(old, new) self.UpdateProcessor.assert_called_once() update = self.updates[0] assert update.table == 'build' for key in ['state', 'task_id', 'owner', 'start_time', 'completion_time', 'epoch']: assert update.data[key] == new[key] assert update.rawdata == {'create_event': 'get_event()'} assert update.clauses == ['id=%(id)s'] assert update.values['id'] == old['id']
def run_pass(self, old, new): kojihub.recycle_build(old, new) self.UpdateProcessor.assert_called_once() update = self.updates[0] assert update.table == 'build' for key in [ 'state', 'task_id', 'owner', 'start_time', 'completion_time', 'epoch' ]: assert update.data[key] == new[key] assert update.rawdata == {'create_event': 'get_event()'} assert update.clauses == ['id=%(id)s'] assert update.values['id'] == old['id']