Exemple #1
0
    def test_no_auth2(self):
        """Function:  test_no_auth2

        Description:  Test with no auth present.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port,
                                     use_uri=self.cfg.use_uri,
                                     auth=False,
                                     use_arg=self.cfg.use_arg,
                                     auth_db=self.cfg.auth_db,
                                     conf_file=self.cfg.conf_file)
        mongo.connect()

        self.assertEqual(
            (mongo.name, mongo.user, mongo.japd, mongo.host, mongo.port),
            (self.cfg.name, self.cfg.user, self.cfg.japd, self.cfg.host,
             self.cfg.port))
Exemple #2
0
    def test_fail_get_srv_attr2(self):
        """Function:  test_fail_get_srv_attr2

        Description:  Test with failed get_srv_attr call.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     "mytestpd",
                                     host=self.cfg.host,
                                     port=self.cfg.port,
                                     use_uri=self.cfg.use_uri,
                                     auth=self.cfg.auth,
                                     use_arg=self.cfg.use_arg,
                                     auth_db=self.cfg.auth_db,
                                     conf_file=self.cfg.conf_file)
        mongo.connect()

        self.assertEqual((mongo.name, mongo.user, mongo.japd, mongo.host,
                          mongo.port, mongo.use_arg),
                         (self.cfg.name, self.cfg.user, "mytestpd",
                          self.cfg.host, self.cfg.port, self.cfg.use_arg))
Exemple #3
0
    def test_using_no_auth_db(self):
        """Function:  test_using_no_auth_db

        Description:  Test using no auth_db attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name, self.user, self.japd,
                                     self.host, self.port)

        self.assertEqual(mongo.auth_db, "admin")
Exemple #4
0
    def test_no_auth_uri(self):
        """Function:  test_no_auth_uri

        Description:  Test with auth and no uri present.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name, self.user, self.japd,
                                     self.host, self.port)

        self.assertFalse(mongo.use_uri)
    def test_config_attr(self):
        """Function:  test_config_attr

        Description:  Test setting the config attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port)

        self.assertEqual(mongo.config, self.config2)
    def test_default_auth(self):
        """Function:  test_default_auth

        Description:  Test using the default auth setting.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port)

        self.assertTrue(mongo.auth)
Exemple #7
0
    def test_ssl_client_ca(self):
        """Function:  test_ssl_client_ca

        Description:  Test with ssl_client_ca attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name,
                                     self.user,
                                     self.japd,
                                     host=self.host,
                                     port=self.port)

        self.assertEqual(mongo.ssl_client_ca, None)
Exemple #8
0
    def test_default_auth_mech(self):
        """Function:  test_default_auth_mech

        Description:  Test auth_mech default setting.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name,
                                     self.user,
                                     self.japd,
                                     host=self.host,
                                     port=self.port)

        self.assertEqual(mongo.auth_mech, self.auth_mech2)
Exemple #9
0
    def test_conn_attr(self):
        """Function:  test_conn_attr

        Description:  Test conn attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name,
                                     self.user,
                                     self.japd,
                                     host=self.host,
                                     port=self.port)

        self.assertFalse(mongo.conn)
    def test_default_conf_file(self):
        """Function:  test_default_conf_file

        Description:  Test using the default conf_file setting.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port)

        self.assertFalse(mongo.conf_file)
Exemple #11
0
    def test_no_auth(self):
        """Function:  test_no_auth

        Description:  Test with no auth present.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name, self.user, self.japd,
                                     self.host, self.port)

        self.assertEqual((mongo.name, mongo.user, mongo.japd, mongo.host,
                          mongo.port, mongo.ismaster, mongo.issecondary),
                         (self.name, self.user, self.japd, self.host,
                          self.port, None, None))
    def test_test_ssl_client_key(self):
        """Function:  test_test_ssl_client_key

        Description:  Test with ssl_client_key attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port)

        self.assertEqual(mongo.ssl_client_key, None)
Exemple #13
0
    def test_name_attr(self):
        """Function:  test_name_attr

        Description:  Test name attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name,
                                     self.user,
                                     self.japd,
                                     host=self.host,
                                     port=self.port)

        self.assertEqual(mongo.name, self.name)
    def test_repset_attr(self):
        """Function:  test_repset_attr

        Description:  Test repset attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port)

        self.assertFalse(mongo.repset)
    def test_user_attr(self):
        """Function:  test_user_attr

        Description:  Test user attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port)

        self.assertEqual(mongo.user, self.cfg.user)
    def test_using_uri(self):
        """Function:  test_using_uri

        Description:  Test using the uri connection.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port,
                                     use_uri=True)

        self.assertTrue(mongo.use_uri)
Exemple #17
0
    def test_ssl_client_phrase2(self):
        """Function:  test_ssl_client_phrase2

        Description:  Test with ssl_client_phrase attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name,
                                     self.user,
                                     self.japd,
                                     host=self.host,
                                     port=self.port,
                                     ssl_client_phrase="Phrase")

        self.assertEqual(mongo.ssl_client_phrase, "Phrase")
    def test_using_auth(self):
        """Function:  test_using_auth

        Description:  Test using the auth connection.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port,
                                     auth=False)

        self.assertFalse(mongo.auth)
    def test_using_auth_db(self):
        """Function:  test_using_auth_db

        Description:  Test using the auth_db attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port,
                                     auth_db=self.cfg.auth_db)

        self.assertEqual(mongo.auth_db, self.cfg.auth_db)
Exemple #20
0
    def test_auth_mech(self):
        """Function:  test_auth_mech

        Description:  Test passing arg to auth_mech attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name,
                                     self.user,
                                     self.japd,
                                     host=self.host,
                                     port=self.port,
                                     auth_mech=self.auth_mech2)

        self.assertEqual(mongo.auth_mech, self.auth_mech2)
    def test_using_conf_file(self):
        """Function:  test_using_conf_file

        Description:  Test using the conf_file connection.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port,
                                     conf_file="myfile")

        self.assertEqual(mongo.conf_file, "myfile")
    def test_config_attr2(self):
        """Function:  test_config_attr2

        Description:  Test with MONGODB-CR setting.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port,
                                     auth_mech=self.auth_mech)

        self.assertEqual(mongo.config, self.config)
    def test_config_attr3(self):
        """Function:  test_config_attr3

        Description:  Test with SCRAM-SHA-1 setting.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port,
                                     auth_mech=self.auth_mech2)

        self.assertEqual(mongo.config, self.config2)
    def test_ssl_client_ca2(self):
        """Function:  test_ssl_client_ca2

        Description:  Test with ssl_client_ca attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port,
                                     ssl_client_ca=self.ssl_client_ca)

        self.assertEqual(mongo.ssl_client_ca, self.ssl_client_ca)
Exemple #25
0
    def test_conn_list_attr(self):
        """Function:  test_conn_list_attr

        Description:  Test setting the conn_list attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name,
                                     self.user,
                                     self.japd,
                                     self.host,
                                     self.port,
                                     auth_db=self.auth_db)

        self.assertEqual(mongo.conn_list, self.conn_list)
Exemple #26
0
    def test_using_arg(self):
        """Function:  test_using_arg

        Description:  Test with auth and arg present.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name,
                                     self.user,
                                     self.japd,
                                     self.host,
                                     self.port,
                                     use_arg=self.use_arg)

        self.assertTrue(mongo.use_arg)
Exemple #27
0
    def test_no_conf_file_attr(self):
        """Function:  test_no_conf_file_attr

        Description:  Test no conf_file attribute passed.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name,
                                     self.user,
                                     self.japd,
                                     self.host,
                                     self.port,
                                     auth_db=self.auth_db)

        self.assertFalse(mongo.conf_file)
Exemple #28
0
    def test_ismaster_attr(self):
        """Function:  test_ismaster_attr

        Description:  Test ismaster attribute.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name,
                                     self.user,
                                     self.japd,
                                     self.host,
                                     self.port,
                                     auth_db=self.auth_db)

        self.assertFalse(mongo.ismaster)
    def test_ssl_client_ca5(self):
        """Function:  test_ssl_client_ca5

        Description:  Test with ssl_client_ca only present.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.cfg.name,
                                     self.cfg.user,
                                     self.cfg.japd,
                                     host=self.cfg.host,
                                     port=self.cfg.port,
                                     conf_file=self.conf_file,
                                     ssl_client_ca=self.ssl_client_ca)

        self.assertEqual(mongo.config, self.config3)
Exemple #30
0
    def test_ssl_client_ca3(self):
        """Function:  test_ssl_client_ca3

        Description:  Test with ssl_client_ca only present.

        Arguments:

        """

        mongo = mongo_class.SlaveRep(self.name,
                                     self.user,
                                     self.japd,
                                     self.host,
                                     self.port,
                                     conf_file=self.conf_file,
                                     ssl_client_ca=self.ssl_client_ca)

        self.assertEqual(mongo.ssl_client_ca, self.ssl_client_ca)