Skip to content

Commit

Permalink
Merge pull request #3 from yvaucher/fix-create-db-odoo-8
Browse files Browse the repository at this point in the history
Add support of `no_login' tag that will allow to run a scenario without having to have erppeek to login.
It will also fix the creation of database with latest version of erppeek
  • Loading branch information
nbessi committed Aug 29, 2014
2 parents ac68da3 + c0a4032 commit 7ff66b6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions features/environment.py
Expand Up @@ -26,14 +26,6 @@ def _output_write(text):
'db_name': database,
'openerp_config': server.tools.config,
}
# We try to manage default login
# even if there is a sentence to log a given user
# Just add options.admin_login_password in your buildout to log from config
admin_login_password = server.tools.config.get('admin_login_password')
if admin_login_password:
ctx.client.login('admin', admin_login_password, database=database)
else:
ctx.client.login('admin', 'admin', database=database)


def before_feature(ctx, feature):
Expand All @@ -45,6 +37,19 @@ def before_scenario(ctx, scenario):
ctx.oe_context = {}
if not hasattr(ctx, 'data'):
ctx.data = {}
# do not login if tag `no_login` is present
# this allow to do database creation and sql requests
# before trying to login in Odoo
if not ctx.client.user and 'no_login' not in scenario.tags:
server = ctx.conf['server']
database = ctx.conf['db_name']
config = server.tools.config
# We try to manage default login
# even if there is a sentence to log a given user
# Just add options.admin_login_password in your buildout to log from
# config
admin_login_password = config.get('admin_login_password', 'admin')
ctx.client.login('admin', admin_login_password, database=database)


def before_step(ctx, step):
Expand Down

0 comments on commit 7ff66b6

Please sign in to comment.