'Ensure that the connect() method works properly with URIs.'

def test_connect_uri(self):

    c = connect(db='mongoenginetest', alias='admin')
    c.admin.system.users.remove({})
    c.mongoenginetest.system.users.remove({})
    c.admin.add_user('admin', 'password')
    c.admin.authenticate('admin', 'password')
    c.mongoenginetest.add_user('username', 'password')
    if (not IS_PYMONGO_3):
        self.assertRaises(MongoEngineConnectionError, connect, 'testdb_uri_bad', host='mongodb://test:password@localhost')
    connect('testdb_uri', host='mongodb://username:password@localhost/mongoenginetest')
    conn = get_connection()
    self.assertTrue(isinstance(conn, pymongo.mongo_client.MongoClient))
    db = get_db()
    self.assertTrue(isinstance(db, pymongo.database.Database))
    self.assertEqual(db.name, 'mongoenginetest')
    c.admin.system.users.remove({})
    c.mongoenginetest.system.users.remove({})
