def test_upgradeDatabaseFail(self):
     setup = mock.Mock(side_effect=lambda **kwargs: defer.succeed(None))
     self.patch(connector.DBConnector, 'setup', setup)
     self.patch(sys, 'stderr', StringIO.StringIO())
     upgrade = mock.Mock(side_effect=lambda **kwargs: defer.fail(Exception("o noz")))
     self.patch(model.Model, 'upgrade', upgrade)
     ret = yield upgrade_master._upgradeMaster(
         mkconfig(basedir='test', quiet=True),
         config_module.MasterConfig())
     self.assertEqual(ret, 1)
     self.assertIn("problem while upgrading!:\nTraceback (most recent call last):\n",
                   sys.stderr.getvalue())
     self.assertIn("o noz", sys.stderr.getvalue())
Beispiel #2
0
 def test_upgradeDatabaseFail(self):
     setup = mock.Mock(side_effect=lambda **kwargs: defer.succeed(None))
     self.patch(connector.DBConnector, 'setup', setup)
     self.patch(sys, 'stderr', StringIO())
     upgrade = mock.Mock(
         side_effect=lambda **kwargs: defer.fail(Exception("o noz")))
     self.patch(model.Model, 'upgrade', upgrade)
     ret = yield upgrade_master._upgradeMaster(
         mkconfig(basedir='test', quiet=True), config_module.MasterConfig())
     self.assertEqual(ret, 1)
     self.assertIn(
         "problem while upgrading!:\nTraceback (most recent call last):\n",
         sys.stderr.getvalue())
     self.assertIn("o noz", sys.stderr.getvalue())