Пример #1
0
 def test_check_fail(self, conn_func_mock):
     conn_func_mock.return_value = conn = MagicMock()
     conn.ping.side_effect = mysql_mod.OperationalError
     ctx = _MySQLContext(one=1)
     self.assertFalse(ctx.check())
     conn_func_mock.assert_called_with(one=1)
     conn.ping.assert_called_with()
Пример #2
0
 def test_check_fail(self, conn_func_mock):
     conn_func_mock.return_value = conn = MagicMock()
     conn.ping.side_effect = mysql_mod.OperationalError
     ctx = _MySQLContext(one=1)
     self.assertFalse(ctx.check())
     conn_func_mock.assert_called_with(one=1)
     conn.ping.assert_called_with()
Пример #3
0
 def test_close(self, conn_func_mock):
     conn_func_mock.return_value = conn = MagicMock()
     ctx = _MySQLContext(one=1)
     ctx.close()
     conn_func_mock.assert_called_with(one=1)
     conn.close.assert_called_with()
Пример #4
0
 def test_check(self, conn_func_mock):
     conn_func_mock.return_value = conn = MagicMock()
     ctx = _MySQLContext(one=1)
     self.assertTrue(ctx.check())
     conn_func_mock.assert_called_with(one=1)
     conn.ping.assert_called_with()
Пример #5
0
 def test_close(self, conn_func_mock):
     conn_func_mock.return_value = conn = MagicMock()
     ctx = _MySQLContext(one=1)
     ctx.close()
     conn_func_mock.assert_called_with(one=1)
     conn.close.assert_called_with()
Пример #6
0
 def test_check(self, conn_func_mock):
     conn_func_mock.return_value = conn = MagicMock()
     ctx = _MySQLContext(one=1)
     self.assertTrue(ctx.check())
     conn_func_mock.assert_called_with(one=1)
     conn.ping.assert_called_with()