def test_slave_not_found(self, mock_find): """Function: test_slave_not_found Description: Test with slave not found. Arguments: """ mock_find.return_value = None self.assertEqual(mysql_libs.fetch_slv(self.slv_list, self.slave), (None, True, self.err_msg))
def test_slave_found(self, mock_find): """Function: test_slave_found Description: Test with slave found. Arguments: """ mock_find.return_value = "Slave1" _, err_flag, err_msg = mysql_libs.fetch_slv(self.slv_list, "Slave1") self.assertEqual((err_flag, err_msg), (False, None))
def test_not_found(self): """Function: test_not_found Description: Test with slave not found. Arguments: """ slaves = cmds_gen.create_cfg_array(self.config_name, cfg_path=self.config_dir) servers = mysql_libs.create_slv_array(slaves) slv, _, _ = mysql_libs.fetch_slv(servers, self.name) self.assertFalse(slv)
def test_not_found2(self): """Function: test_not_found2 Description: Test with slave not found. Arguments: """ slaves = cmds_gen.create_cfg_array(self.config_name, cfg_path=self.config_dir) servers = mysql_libs.create_slv_array(slaves) _, err_flag, err_msg = mysql_libs.fetch_slv(servers, self.name) self.assertEqual((err_flag, err_msg), (True, self.err_msg))
def test_found2(self): """Function: test_found2 Description: Test with slave found. Arguments: """ slaves = cmds_gen.create_cfg_array(self.config_name, cfg_path=self.config_dir) name = slaves[0]["name"] servers = mysql_libs.create_slv_array(slaves) _, err_flag, err_msg = mysql_libs.fetch_slv(servers, name) self.assertEqual((err_flag, err_msg), (False, None))
def test_found(self): """Function: test_found Description: Test with slave found. Arguments: """ slaves = cmds_gen.create_cfg_array(self.config_name, cfg_path=self.config_dir) name = slaves[0]["name"] servers = mysql_libs.create_slv_array(slaves) slv, _, _ = mysql_libs.fetch_slv(servers, name) self.assertTrue(isinstance(slv, mysql_class.SlaveRep))