Exemple #1
0
 def test_is_up_shold_return_true_when_instance_is_running_and_db_is_up(self):
     mocker = Mocker()
     obj = mocker.replace("mysqlapi.api.models.DatabaseManager.is_up")
     obj()
     mocker.result(True)
     mocker.replay()
     instance = Instance(name="foo", state="running")
     manager = DatabaseManager("foo", "127.0.0.1")
     self.assertTrue(instance.is_up(manager))
Exemple #2
0
 def test_is_up_should_return_false_when_instance_is_not_running(self):
     mocker = Mocker()
     obj = mocker.replace("mysqlapi.api.models.DatabaseManager.is_up")
     obj()
     mocker.result(False)
     mocker.replay()
     instance = Instance(name="foo", state="running")
     manager = DatabaseManager("foo", "127.0.0.1")
     self.assertFalse(instance.is_up(manager))
Exemple #3
0
 def test_is_up_should_return_false_when_instance_is_not_running(self):
     with mock.patch("mysqlapi.api.models.DatabaseManager.is_up") as is_up:
         is_up.return_value = False
         instance = Instance(name="foo", state="running")
         self.assertFalse(instance.is_up())
Exemple #4
0
 def test_is_up_returns_true_when_instance_is_running_and_db_is_up(self):
     with mock.patch("mysqlapi.api.models.DatabaseManager.is_up") as is_up:
         is_up.return_value = True
         instance = Instance(name="foo", state="running")
         self.assertTrue(instance.is_up())
Exemple #5
0
 def test_is_up_should_return_false_when_instance_is_not_running(self):
     with mock.patch("mysqlapi.api.models.DatabaseManager.is_up") as is_up:
         is_up.return_value = False
         instance = Instance(name="foo", state="running")
         self.assertFalse(instance.is_up())
Exemple #6
0
 def test_is_up_returns_true_when_instance_is_running_and_db_is_up(self):
     with mock.patch("mysqlapi.api.models.DatabaseManager.is_up") as is_up:
         is_up.return_value = True
         instance = Instance(name="foo", state="running")
         self.assertTrue(instance.is_up())