def setup_method(self, method): """Set up environment for each test.""" super().setup_method(method) self.release = self.db.query(Release).filter_by(name='F17').first() if self.release: self.release.create_automatic_updates = True self.db.flush() else: self.release = self.create_release('17', create_automatic_updates=True) body = { 'build_id': 442562, 'name': 'colord', 'tag_id': 214, 'instance': 's390', 'tag': 'f17-updates-candidate', 'user': '******', 'version': '1.3.4', 'owner': 'sharkcz', 'release': '1.fc26', } self.sample_message = Message(topic='', body=body) self.sample_nvr = f"{body['name']}-{body['version']}-{body['release']}" self.db_factory = base.TransactionalSessionMaker(self.Session) self.handler = AutomaticUpdateHandler(self.db_factory)
def __init__(self): """Set up the database, build system, bug tracker, and handlers.""" log.info('Initializing Bodhi') initialize_db(config) buildsys.setup_buildsystem(config) bugs.set_bugtracker() self.handler_infos = [ HandlerInfo('.buildsys.tag', "Signed", SignedHandler()), HandlerInfo('.buildsys.tag', 'Automatic Update', AutomaticUpdateHandler()), HandlerInfo('.greenwave.decision.update', 'Greenwave', GreenwaveHandler()), HandlerInfo('.ci.koji-build.test.running', 'CI', CIHandler()) ]
def __init__(self): """Set up the database, build system, bug tracker, and handlers.""" log.info('Initializing Bodhi') initialize_db(config) buildsys.setup_buildsystem(config) bugs.set_bugtracker() self.handler_infos = [ HandlerInfo('.buildsys.tag', "Signed", SignedHandler()), HandlerInfo('.buildsys.tag', 'Automatic Update', AutomaticUpdateHandler()), HandlerInfo('.ci.koji-build.test.running', 'CI', CIHandler()), HandlerInfo('.waiverdb.waiver.new', 'WaiverDB', WaiverdbHandler()), HandlerInfo('.resultsdb.result.new', 'ResultsDB', ResultsdbHandler()), ]
def __init__(self): """Set up the database, build system, bug tracker, and handlers.""" log.info('Initializing Bodhi') initialize_db(config) buildsys.setup_buildsystem(config) bugs.set_bugtracker() self.automatic_update_handler = AutomaticUpdateHandler() if ComposerHandler: self.composer_handler = ComposerHandler() else: log.info( 'The composer is not installed - Bodhi will ignore composer.start messages.' ) self.composer_handler = None self.signed_handler = SignedHandler() self.updates_handler = UpdatesHandler()
def test___init___without_db_factory(self, transactional_session_maker): """__init__() should create db_factory if missing.""" handler = AutomaticUpdateHandler() assert handler.db_factory is transactional_session_maker.return_value transactional_session_maker.assert_called_once_with()