def startService(self): upgradeConfig = {'basedir': self.basedir, 'quiet': True} masterConfig = loadConfig(upgradeConfig, self.configFile) d = upgradeDatabase(upgradeConfig, masterConfig) d.addCallback(lambda _: self.afterService.setServiceParent(self.parent)) d.addErrback(log.err) d.addErrback(lambda _: reactor.stop())
def startService(self): upgradeConfig = {'basedir': self.basedir, 'quiet': True} masterConfig = loadConfig(upgradeConfig, self.configFile) d = upgradeDatabase(upgradeConfig, masterConfig) d.addCallback( lambda _: self.afterService.setServiceParent(self.parent)) d.addErrback(log.err) d.addErrback(lambda _: reactor.stop())
def test_upgradeDatabase(self): setup = mock.Mock(side_effect=lambda **kwargs: defer.succeed(None)) self.patch(connector.DBConnector, 'setup', setup) upgrade = mock.Mock(side_effect=lambda **kwargs: defer.succeed(None)) self.patch(model.Model, 'upgrade', upgrade) yield upgrade_master.upgradeDatabase( mkconfig(basedir='test', quiet=True), config_module.MasterConfig()) setup.asset_called_with(check_version=False, verbose=False) upgrade.assert_called_with() self.assertWasQuiet()
def test_upgradeDatabase(self): setup = mock.Mock(side_effect=lambda **kwargs: defer.succeed(None)) self.patch(connector.DBConnector, 'setup', setup) upgrade = mock.Mock(side_effect=lambda **kwargs: defer.succeed(None)) self.patch(model.Model, 'upgrade', upgrade) yield upgrade_master.upgradeDatabase( mkconfig(basedir='test', quiet=True), config_module.MasterConfig()) setup.asset_called_with(check_version=False, verbose=False) upgrade.assert_called_with() self.assertWasQuiet()