Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongomock connection error #191

Closed
brunobelarmino opened this issue Dec 21, 2015 · 1 comment
Closed

mongomock connection error #191

brunobelarmino opened this issue Dec 21, 2015 · 1 comment

Comments

@brunobelarmino
Copy link
Member

I'm trying to test a flask application which use flask-mongoengine and when i put "mongomock://localhost" on "MONGODB_HOST" or "MONGODB_SETTINGS" setting i have experienced an error: pymongo.errors.InvalidURI: Invalid URI scheme: URI must begin with 'mongodb://'

It happens because flask-mongengine don't expect mongomock uri like raw mongoengine:

flask-mongoengine _create_connection method:

if "://" in conn.get('host', ''):
    uri_dict = uri_parser.parse_uri(conn['host'])
    conn['db'] = uri_dict['database']

mongoengine register_connection method:

conn_host = conn_settings['host']
if conn_host.startswith('mongomock://'):
    conn_settings['is_mock'] = True
elif '://' in conn_host:
    uri_dict = uri_parser.parse_uri(conn_host)

Any advice?

@lafrech
Copy link
Member

lafrech commented Feb 23, 2016

I'm closing this a I believe this is addressed (or will be addressed) by #98. Please (accept my apologies and) reopen if I'm wrong.

@lafrech lafrech closed this as completed Feb 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants