def test_no_dbs(self, mock_fetch, mock_version): """Function: test_no_dbs Description: Test with no databases from master or slave. Arguments: """ mock_version.return_value = self.version mock_fetch.side_effect = [[], []] self.assertFalse(mysql_rep_cmp.setup_cmp(self.master, self.slave, []))
def test_no_matches(self, mock_fetch, mock_version): """Function: test_no_matches Description: Test with no matches between master and slave. Arguments: """ mock_version.return_value = self.version mock_fetch.side_effect = [self.dblist2, self.dblist3] self.assertFalse(mysql_rep_cmp.setup_cmp(self.master, self.slave, []))
def test_one_db(self, mock_fetch, mock_tbl, mock_version): """Function: test_master_db Description: Test with one database to check. Arguments: """ mock_version.return_value = self.version mock_fetch.side_effect = [self.dblist, self.dblist] mock_tbl.side_effect = [self.databases, self.databases] self.assertFalse(mysql_rep_cmp.setup_cmp(self.master, self.slave, []))
def test_do_tbls(self, mock_fetch, mock_tbl, mock_version): """Function: test_do_tbls Description: Test with slave do tables found. Arguments: """ self.slave.do_tbl = {"db1": ["tbl1", "tbl2"], "db2": ["tbl3"]} mock_version.return_value = self.version mock_fetch.side_effect = [self.dblist2, self.dblist2] mock_tbl.side_effect = [self.databases, self.databases2] self.assertFalse(mysql_rep_cmp.setup_cmp(self.master, self.slave, []))
def test_sys_ign_db(self, mock_fetch, mock_tbl, mock_version): """Function: test_sys_ign_db Description: Test with sys_ign_db is passed. Arguments: """ self.slave.ign_tbl = {"db1": ["tbl1", "tbl2"]} mock_version.return_value = self.version mock_fetch.side_effect = [self.dblist2, self.dblist2] mock_tbl.side_effect = [ self.databases, self.databases, self.databases2, self.databases2 ] self.assertFalse( mysql_rep_cmp.setup_cmp(self.master, self.slave, self.sys_ign_db))
def test_no_std_out(self, mock_fetch, mock_tbl, mock_version): """Function: test_no_std_out Description: Test with passing no standard out suppression. Arguments: """ self.slave.ign_tbl = {"db1": ["tbl1", "tbl2"]} mock_version.return_value = self.version mock_fetch.side_effect = [self.dblist2, self.dblist2] mock_tbl.side_effect = [ self.databases, self.databases, self.databases2, self.databases2 ] self.assertFalse( mysql_rep_cmp.setup_cmp(self.master, self.slave, self.sys_ign_db, db_name=self.dblist, no_std=self.no_std))
def test_mysql_80(self, mock_fetch, mock_tbl, mock_version): """Function: test_mysql_80 Description: Test with MySQL 8.0 version database. Arguments: """ self.slave.ign_tbl = {"db1": ["tbl1", "tbl2"]} mock_version.return_value = self.version2 mock_fetch.side_effect = [self.dblist2, self.dblist2] mock_tbl.side_effect = [ self.databases3, self.databases3, self.databases4, self.databases4 ] self.assertFalse( mysql_rep_cmp.setup_cmp(self.master, self.slave, self.sys_ign_db, db_name=self.dblist, no_std=self.no_std))
def test_email_mailx(self, mock_fetch, mock_tbl, mock_version): """Function: test_email_mailx Description: Test with email using use_mailx option. Arguments: """ self.slave.ign_tbl = {"db1": ["tbl1", "tbl2"]} mock_version.return_value = self.version mock_fetch.side_effect = [self.dblist2, self.dblist2] mock_tbl.side_effect = [ self.databases, self.databases, self.databases2, self.databases2 ] self.assertFalse( mysql_rep_cmp.setup_cmp(self.master, self.slave, self.sys_ign_db, db_name=self.dblist, mail=self.mail, use_mailx=False))