Beispiel #1
0
    def test_ssl_false(self):
        """Function:  test_ssl_false

        Description:  Test with no SSL option present.

        Arguments:

        """

        self.mongo.config.pop("ssl", None)
        self.assertEqual(mongo_libs.crt_base_cmd(self.mongo, self.prog_name),
                         self.results)
Beispiel #2
0
    def test_ssl_false2(self):
        """Function:  test_ssl_false2

        Description:  Test with SSL option set to False.

        Arguments:

        """

        self.mongo.config["ssl"] = False
        self.assertEqual(mongo_libs.crt_base_cmd(self.mongo, self.prog_name),
                         self.results)
Beispiel #3
0
    def test_host(self):
        """Function:  test_host

        Description:  Test with host name for connection.

        Arguments:

        """

        self.mongo.config["ssl"] = False
        cmdline = mongo_libs.crt_base_cmd(self.mongo, self.prog_name)

        self.assertEqual(cmdline, self.results)
Beispiel #4
0
    def test_auth(self):
        """Function:  test_auth

        Description:  Test with authority needed.

        Arguments:

        """

        self.mongo.config["ssl"] = False
        cmdline = mongo_libs.crt_base_cmd(self.mongo, self.prog_name)

        self.assertEqual(cmdline, self.results)
Beispiel #5
0
    def test_no_auth(self):

        """Function:  test_no_auth

        Description:  Test with no authority needed.

        Arguments:

        """

        mongo = Mongo()
        mongo.auth = False
        self.assertEqual(mongo_libs.crt_base_cmd(mongo, self.prog_name),
                         [self.prog_name, self.host_port3])
Beispiel #6
0
    def test_auth_no_pass(self):

        """Function:  test_auth_no_pass

        Description:  Test with auth and no_pass set to True.

        Arguments:

        """

        mongo = Mongo()
        self.assertEqual(
            mongo_libs.crt_base_cmd(mongo, self.prog_name, no_pass=True),
            [self.prog_name, self.uname + self.user, self.host_port3])
Beispiel #7
0
    def test_repset_hosts(self):

        """Function:  test_repset_hosts

        Description:  Test with repset name and hosts for connection.

        Arguments:

        """

        mongo = Mongo()
        self.assertEqual(
            mongo_libs.crt_base_cmd(mongo, self.prog_name, use_repset=True),
            [self.prog_name, self.uname + self.user, self.host_port,
             self.japd2 + self.japd])
Beispiel #8
0
    def test_host(self):

        """Function:  test_host

        Description:  Test with host name for connection.

        Arguments:

        """

        mongo = Mongo()
        self.assertEqual(
            mongo_libs.crt_base_cmd(mongo, self.prog_name),
            [self.prog_name, self.uname + self.user, self.host_port3,
             self.japd2 + self.japd])
Beispiel #9
0
    def test_ssl_false(self):

        """Function:  test_ssl_false

        Description:  Test with no SSL option present.

        Arguments:

        """

        mongo = Mongo()
        self.assertEqual(
            mongo_libs.crt_base_cmd(mongo, self.prog_name),
            [self.prog_name, self.uname + self.user, self.host_port3,
             self.japd2 + self.japd])
Beispiel #10
0
    def test_repset(self):
        """Function:  test_repset

        Description:  Test with repset name for connection.

        Arguments:

        """

        self.mongorep.config["ssl"] = False
        cmdline = mongo_libs.crt_base_cmd(self.mongorep,
                                          self.prog_name,
                                          use_repset=True)

        self.assertEqual(cmdline, self.results2)
Beispiel #11
0
    def test_auth_pass(self):
        """Function:  test_auth_pass

        Description:  Test with auth and no_pass set to False.

        Arguments:

        """

        self.mongo.config["ssl"] = False
        cmdline = mongo_libs.crt_base_cmd(self.mongo,
                                          self.prog_name,
                                          no_pass=False)

        self.assertEqual(cmdline, self.results)
Beispiel #12
0
    def test_ssl_false2(self):

        """Function:  test_ssl_false2

        Description:  Test with SSL option set to False.

        Arguments:

        """

        mongo = Mongo()
        mongo.config["ssl"] = False
        self.assertEqual(
            mongo_libs.crt_base_cmd(mongo, self.prog_name),
            [self.prog_name, self.uname + self.user, self.host_port3,
             self.japd2 + self.japd])
Beispiel #13
0
    def test_ssl_true(self):
        """Function:  test_ssl_true

        Description:  Test with SSL option set to True.

        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.assertEqual(mongo_libs.crt_base_cmd(self.mongo, self.prog_name),
                         self.results6)