Пример #1
0
    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'])
Пример #2
0
    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'])
Пример #3
0
    def test_parse_db_argstring_without_user_pass_no_host(self):
        mongo_spec = 'local'

        with self.assertRaises(Exception):
            NoodleMongoClient.parse_db_argstring(mongo_spec)