コード例 #1
0
 def test_extract_db_config_without_login(self):
     config = Utility.extract_db_config("mongodb://localhost/test")
     assert config['db'] == "test"
     assert config['username'] is None
     assert config['password'] is None
     assert config['host'] == "mongodb://localhost"
     assert len(config["options"]) == 0
コード例 #2
0
 def test_extract_db_config_with_login(self):
     config = Utility.extract_db_config(
         "mongodb://*****:*****@localhost/test?authSource=admin")
     assert config['db'] == "test"
     assert config['username'] == "admin"
     assert config['password'] == "admin"
     assert config['host'] == "mongodb://localhost"
     assert "authSource" in config['options']