Пример #1
0
    def test_primary_chk(self, mock_mst, mock_lag):
        """Function:  test_primary_chk

        Description:  Test with time lag for primary check.

        Arguments:

        """

        mock_mst.return_value = self.get_master
        mock_lag.return_value = self.status

        self.assertEqual(
            mongo_rep_admin.chk_rep_lag(self.server, self.args_array),
            self.results)
Пример #2
0
    def test_mongo_successful(self, mock_mst, mock_lag):
        """Function:  test_mongo_successful

        Description:  Test with successful connection.

        Arguments:

        """

        mock_mst.return_value = self.get_master
        mock_lag.return_value = self.status

        self.assertEqual(
            mongo_rep_admin.chk_rep_lag(self.server, self.args_array),
            self.results)
Пример #3
0
    def test_mongo_std_fail(self, mock_mst, mock_lag):
        """Function:  test_mongo_std_fail

        Description:  Test with failed connection to Mongo for std.

        Arguments:

        """

        mock_mst.return_value = self.get_master
        mock_lag.return_value = self.status2

        self.assertEqual(
            mongo_rep_admin.chk_rep_lag(self.server, self.args_array),
            self.results2)
Пример #4
0
    def test_secondary_chk(self, mock_mst, mock_lag, mock_time):
        """Function:  test_secondary_chk

        Description:  Test with time lag for secondary check.

        Arguments:

        """

        mock_mst.return_value = {}
        mock_lag.return_value = self.status
        mock_time.return_value = "2019-07-26 11:13:02"

        self.assertEqual(
            mongo_rep_admin.chk_rep_lag(self.server, self.args_array),
            self.results)