Beispiel #1
0
    def test_ssl_ca_phrase(self):

        """Function:  test_ssl_ca_phrase

        Description:  Test with CA File and PEMKey phrase file.

        Arguments:

        """

        global KEY1
        global KEY2
        global KEY3
        global KEY4

        self.mongo.config["ssl"] = True
        self.mongo.config.pop("ssl_ca_certs", None)
        self.mongo.config.pop("ssl_keyfile", None)
        self.mongo.config.pop(KEY3 + KEY1 + KEY4, None)
        self.mongo.config["ssl_keyfile"] = self.key_file
        self.mongo.config[KEY3 + KEY1 + KEY4] = self.key_phrase
        self.mongo.config["ssl_ca_certs"] = self.ca_file
        result_cmd = list(self.cmd_line)
        result_cmd.append(self.ssl)
        result_cmd.append(self.ssl_ca + self.ca_file)
        result_cmd.append(self.ssl_key + self.key_file)
        result_cmd.append(self.ssl_phrase + KEY2 + "=" + self.key_phrase)

        self.assertEqual(
            mongo_libs.add_ssl_cmd(self.mongo, self.cmd_line), result_cmd)
Beispiel #2
0
    def test_ssl_ca(self):

        """Function:  test_ssl_ca

        Description:  Test with CA file.

        Arguments:

        """

        global KEY1
        global KEY3
        global KEY4

        self.mongo.config["ssl"] = True
        self.mongo.config.pop("ssl_ca_certs", None)
        self.mongo.config.pop("ssl_keyfile", None)
        self.mongo.config.pop(KEY3 + KEY1 + KEY4, None)
        self.mongo.config["ssl_ca_certs"] = self.ca_file
        result_cmd = list(self.cmd_line)
        result_cmd.append(self.ssl)
        result_cmd.append(self.ssl_ca + self.ca_file)

        self.assertEqual(
            mongo_libs.add_ssl_cmd(self.mongo, self.cmd_line), result_cmd)
Beispiel #3
0
    def test_no_ssl(self):
        """Function:  test_no_ssl

        Description:  Test with no ssl in config.

        Arguments:

        """

        result_cmd = list(self.cmd_line)

        self.assertEqual(mongo_libs.add_ssl_cmd(self.mongo, self.cmd_line),
                         result_cmd)
Beispiel #4
0
    def test_ssl_false(self):
        """Function:  test_ssl_false

        Description:  Test with ssl set to False.

        Arguments:

        """

        self.mongo.config["ssl"] = False
        result_cmd = list(self.cmd_line)

        self.assertEqual(mongo_libs.add_ssl_cmd(self.mongo, self.cmd_line),
                         result_cmd)
Beispiel #5
0
    def test_ssl_true(self):
        """Function:  test_ssl_true

        Description:  Test with ssl set to True.

        Arguments:

        """

        self.mongo.config["ssl"] = True
        result_cmd = list(self.cmd_line)
        result_cmd.append(self.ssl)

        self.assertEqual(mongo_libs.add_ssl_cmd(self.mongo, self.cmd_line),
                         result_cmd)
Beispiel #6
0
    def test_ssl_ca(self):
        """Function:  test_ssl_ca

        Description:  Test with CA file.

        Arguments:

        """

        self.mongo2.config["ssl_ca_certs"] = self.ca_file
        result_cmd = list(self.cmd_line)
        result_cmd.append(self.ssl)
        result_cmd.append(self.ssl_ca + self.ca_file)

        self.assertEqual(mongo_libs.add_ssl_cmd(self.mongo2, self.cmd_line),
                         result_cmd)
Beispiel #7
0
    def test_ssl_key(self):
        """Function:  test_ssl_key

        Description:  Test with PEMKey file.

        Arguments:

        """

        self.mongo2.config["ssl_keyfile"] = self.key_file
        result_cmd = list(self.cmd_line)
        result_cmd.append(self.ssl)
        result_cmd.append(self.ssl_key + self.key_file)

        self.assertEqual(mongo_libs.add_ssl_cmd(self.mongo2, self.cmd_line),
                         result_cmd)
Beispiel #8
0
    def test_ssl_phrase(self):
        """Function:  test_ssl_phrase

        Description:  Test with PEMKey phrase file.

        Arguments:

        """

        self.mongo2.config["ssl_keyfile"] = self.key_file
        self.mongo2.config[KEY3 + KEY1 + KEY4] = self.key_phrase
        result_cmd = list(self.cmd_line)
        result_cmd.append(self.ssl)
        result_cmd.append(self.ssl_key + self.key_file)
        result_cmd.append(self.ssl_phrase + KEY2 + "=" + self.key_phrase)

        self.assertEqual(mongo_libs.add_ssl_cmd(self.mongo2, self.cmd_line),
                         result_cmd)