def test_rep_set_ssl(self): """Function: test_rep_set_ssl Description: Test mongo_class.RepSetColl class with SSL set. Arguments: """ mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertEqual(mongo.ssl_client_ca, self.cfg.ssl_client_ca)
def test_coll_none_ssl(self): """Function: test_coll_none_ssl Description: Test mongo_class.Coll class with SSL set to none. Arguments: """ cfg = Cfg2() mongo = mongo_libs.crt_coll_inst(cfg, "db", "tbl") self.assertFalse(mongo.ssl_client_ca)
def test_coll_auth_mech2(self): """Function: test_coll_auth_mech2 Description: Test with authentication mechanism. Arguments: """ self.cfg.repset_hosts = None mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertTrue(isinstance(mongo, mongo_class.Coll))
def test_coll2(self): """Function: test_coll2 Description: Test the mongo_class.Coll class. Arguments: """ self.cfg.repset_hosts = None mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertTrue(isinstance(mongo, mongo_class.Coll))
def test_repsetcoll(self, mock_mongo): """Function: test_repsetcoll Description: Test the mongo_class.RepSetColl class. Arguments: """ cfg = Cfg(self.repset_hosts) mock_mongo.return_value = True self.assertTrue(mongo_libs.crt_coll_inst(cfg, "db", "tbl"))
def test_repsetcoll_new_attrs(self, mock_mongo): """Function: test_repsetcoll_new_attrs Description: Test with new use_uri, use_arg, and auth_db attrs. Arguments: """ cfg = Cfg(self.repset_hosts) mock_mongo.return_value = True self.assertTrue(mongo_libs.crt_coll_inst(cfg, "db", "tbl"))
def test_repset_no_mech_auth(self, mock_mongo): """Function: test_repset_no_mech_auth Description: Test with no authentication mechanism passed. Arguments: """ cfg = Cfg(self.repset_hosts) mock_mongo.return_value = True self.assertTrue(mongo_libs.crt_coll_inst(cfg, "db", "tbl"))
def test_rep_no_ssl(self): """Function: test_rep_no_ssl Description: Test the mongo_class.RepSetColl class with no ssl. Arguments: """ cfg = Cfg(self.repset_hosts) mongo = mongo_libs.crt_coll_inst(cfg, "db", "tbl") self.assertFalse(mongo.ssl_client_ca)
def test_rep_set_ssl(self): """Function: test_rep_set_ssl Description: Test mongo_class.RepSetColl class with SSL set. Arguments: """ cfg = Cfg3(self.repset_hosts) mongo = mongo_libs.crt_coll_inst(cfg, "db", "tbl") self.assertEqual(mongo.ssl_client_ca, cfg.ssl_client_ca)
def test_coll_auth_mech(self): """Function: test_coll_auth_mech Description: Test with authentication mechanism. Arguments: """ self.cfg.repset_hosts = None mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertEqual((mongo.auth_db, mongo.auth_mech), (self.cfg.auth_db, self.cfg.auth_mech))
def test_auth_db_coll2(self): """Function: test_auth_db_coll2 Description: Test mongo_class.Coll using auth_db attr. Arguments: """ self.cfg.auth_db = "test" mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertTrue(isinstance(mongo, mongo_class.Coll))
def test_repsetcoll2(self): """Function: test_repsetcoll2 Description: Test the mongo_class.RepSetColl class. Arguments: """ self.cfg.repset_hosts = self.cfg.host + ":" + str(self.cfg.port) mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertTrue(isinstance(mongo, mongo_class.RepSetColl))
def test_rep_none_ssl(self): """Function: test_rep_none_ssl Description: Test mongo_class.RepSetColl class with SSL set to none. Arguments: """ tmp = self.cfg.ssl_client_ca self.cfg.ssl_client_ca = None mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.cfg.ssl_client_ca = tmp self.assertFalse(mongo.ssl_client_ca)
def test_auth_db_repsetcoll2(self): """Function: test_auth_db_repsetcoll2 Description: Test mongo_class.RepSetColl using auth_db attr. Arguments: """ self.cfg.repset_hosts = self.cfg.host + ":" + str(self.cfg.port) self.cfg.auth_db = "test" mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertTrue(isinstance(mongo, mongo_class.RepSetColl))
def test_repset_auth_mech3(self): """Function: test_repset_auth_mech3 Description: Test with authentication mechanism - MONGODB-CR. Arguments: """ self.cfg.repset_hosts = self.cfg.host + ":" + str(self.cfg.port) self.cfg.auth_mech = "MONGODB-CR" mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertEqual((mongo.auth_db, mongo.auth_mech), (self.cfg.auth_db, self.cfg.auth_mech))
def test_coll(self): """Function: test_coll Description: Test the mongo_class.Coll class. Arguments: """ mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertEqual( (mongo.name, mongo.user, mongo.japd, mongo.host, mongo.port, mongo.auth, mongo.conf_file), (self.cfg.name, self.cfg.user, self.cfg.japd, self.cfg.host, self.cfg.port, self.cfg.auth, self.cfg.conf_file))
def test_use_uri_repsetcoll2(self): """Function: test_use_uri_repsetcoll2 Description: Test mongo_class.RepSetColl using use_uri attr. Arguments: """ self.cfg.repset_hosts = self.cfg.host + ":" + str(self.cfg.port) self.cfg.use_arg = False self.cfg.use_uri = True mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertTrue(isinstance(mongo, mongo_class.RepSetColl))
def test_use_arg_repsetcoll(self): """Function: test_use_arg_repsetcoll Description: Test mongo_class.RepSetColl using use_arg attr. Arguments: """ self.cfg.repset_hosts = self.cfg.host + ":" + str(self.cfg.port) mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertEqual( (mongo.name, mongo.user, mongo.japd, mongo.host, mongo.port, mongo.auth, mongo.conf_file, mongo.use_arg), (self.cfg.name, self.cfg.user, self.cfg.japd, self.cfg.host, self.cfg.port, self.cfg.auth, self.cfg.conf_file, True))
def test_auth_db_coll(self): """Function: test_auth_db_coll Description: Test mongo_class.Coll using auth_db attr. Arguments: """ self.cfg.auth_db = "test" mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertEqual( (mongo.name, mongo.user, mongo.japd, mongo.host, mongo.port, mongo.auth, mongo.conf_file, mongo.auth_db), (self.cfg.name, self.cfg.user, self.cfg.japd, self.cfg.host, self.cfg.port, self.cfg.auth, self.cfg.conf_file, "test"))
def test_use_uri_coll(self): """Function: test_use_uri_coll Description: Test mongo_class.Coll using use_uri attr. Arguments: """ self.cfg.use_arg = False self.cfg.use_uri = True mongo = mongo_libs.crt_coll_inst(self.cfg, self.dbn, self.coll) self.assertEqual( (mongo.name, mongo.user, mongo.japd, mongo.host, mongo.port, mongo.auth, mongo.conf_file, mongo.use_uri), (self.cfg.name, self.cfg.user, self.cfg.japd, self.cfg.host, self.cfg.port, self.cfg.auth, self.cfg.conf_file, True))