def test_parse_db_argstring_without_user_pass(self): mongo_spec = '127.0.0.1:local' mongo_connection_tuple = NoodleMongoClient.parse_db_argstring(mongo_spec) self.assertEqual(list(mongo_connection_tuple), ['mongodb://127.0.0.1:27017/local', 27017, 'local'])
def test_parse_db_argstring_with_user_pass_localhost_with_port(self): mongo_spec = 'noodle:pass@localhost:27017:local' mongo_connection_tuple = NoodleMongoClient.parse_db_argstring(mongo_spec) self.assertEqual(list(mongo_connection_tuple), ['mongodb://*****:*****@localhost:27017/local', 27017, 'local'])
def test_parse_argstring_with_user_pass(self): mongo_spec = 'noodle:[email protected]:local:categories' mongo_connection_tuple = NoodleMongoClient.parse_argstring(mongo_spec) self.assertEqual(list(mongo_connection_tuple), ['mongodb://*****:*****@127.0.0.1:27017/local', 27017, 'local', 'categories'])
def test_parse_db_argstring_without_user_pass_no_host(self): mongo_spec = 'local' with self.assertRaises(Exception): NoodleMongoClient.parse_db_argstring(mongo_spec)