Esempio n. 1
0
    def test_fetch_slv_fails(self, mock_fetch):

        """Function:  test_fetch_slv_fails

        Description:  Test with fetching slave fails.

        Arguments:

        """

        mock_fetch.return_value = (None, True, self.err_msg)

        self.assertEqual(mysql_rep_change.move_slave(
            self.master, self.slaves, args=self.args2), (True, self.err_msg))
Esempio n. 2
0
    def test_create_slave_fails(self, mock_crt):

        """Function:  test_sync_fails

        Description:  Test with create of slave fails.

        Arguments:

        """

        mock_crt.return_value = (None, True, self.err_msg2)

        self.assertEqual(mysql_rep_change.move_slave(
            self.master, self.slaves, args=self.args2), (True, self.err_msg2))
Esempio n. 3
0
    def test_r_option(self, mock_newmst):

        """Function:  test_r_option

        Description:  Test with -R option selected.

        Arguments:

        """

        mock_newmst.return_value = (self.new_master, False, None)

        self.assertEqual(
            mysql_rep_change.move_slave(
                self.master, self.slaves, args=self.args,
                new_mst=self.new_mst), (False, None))
Esempio n. 4
0
    def test_move_fails(self, mock_move, mock_newmst):

        """Function:  test_move_fails

        Description:  Test with move of slave to master fails.

        Arguments:

        """

        mock_newmst.return_value = (self.new_master, False, None)
        mock_move.return_value = (True, self.err_msg3)

        self.assertEqual(
            mysql_rep_change.move_slave(
                self.master, self.slaves, args=self.args2),
            (True, self.err_msg3))