diff --git a/test/behave/environment.py b/test/behave/environment.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/test/behave/features/environment.py b/test/behave/features/environment.py index 9bc350cc9718d8ef048828e0a01d5d5625295ce4..dc46d648ba6b02befc9349d7c7f45ddc1b9de166 100644 --- a/test/behave/features/environment.py +++ b/test/behave/features/environment.py @@ -35,36 +35,27 @@ def before_all(context): def before_tag(context, tag): + def get_values(app): + values = {} + values['url'] = userdata.get(app + '.url') + values['username'] = \ + userdata.get(app + '.username', 'admin') + values['password'] = \ + userdata.get(app + '.password') + assert values['url'], '{0}.url variable missing in' \ + 'userdata. Provide it with "-D {0}.url".'.format(app) + assert values['username'], '{0}.username variable missing in' \ + 'userdata. Provide it with "-D {0}.username".'.format(app) + assert values['password'], '{0}.password variable missing in' \ + 'userdata. Provide it with "-D {0}.password".'.format(app) + return(values) + userdata = context.config.userdata if tag == 'grafana': - context.grafana = {} - context.grafana['url'] = userdata.get('grafana.url') - context.grafana['username'] = \ - userdata.get('grafana.username', 'admin') - context.grafana['password'] = \ - userdata.get('grafana.password') - - assert context.grafana['url'], 'grafana url variable missing in' \ - 'userdata. Provide it with "-D grafana.url".' - assert context.grafana['username'], 'grafana username variable' \ - 'missing in userdata. Provide it with "-D grafana.username".' - assert context.grafana['password'], 'grafana password variable' \ - 'missing in userdata. Provide it with "-D grafana.password".' + context.grafana = get_values('grafana') if tag == 'nextcloud': - context.nextcloud = {} - context.nextcloud['url'] = userdata.get('nextcloud.url') - context.nextcloud['username'] = \ - userdata.get('nextcloud.username', 'admin') - context.nextcloud['password'] = \ - userdata.get('nextcloud.password') - - assert context.nextcloud['url'], 'Nextcloud url variable missing in' \ - 'userdata. Provide it with "-D nextcloud.url".' - assert context.nextcloud['username'], 'Nextcloud username variable' \ - 'missing in userdata. Provide it with "-D nextcloud.username".' - assert context.nextcloud['password'], 'Nextcloud password variable' \ - 'missing in userdata. Provide it with "-D nextcloud.password".' + context.grafana = get_values('nextcloud') diff --git a/test/behave/features/steps/login.py b/test/behave/features/steps/login.py index 21bfe238652159174e7979fb5e6ecaecfd769fc4..b907459c5e9bc168675978e72ff35a53455b6ecf 100644 --- a/test/behave/features/steps/login.py +++ b/test/behave/features/steps/login.py @@ -6,14 +6,14 @@ from behave_webdriver.steps import * @when(u'I open the nextcloud URL') @given(u'I open the nextcloud URL') def step_impl(context): - """Login to nextcloud.""" + """Open nextcloud URL.""" context.behave_driver.get(context.nextcloud['url']) @when(u'I open the grafana URL') @given(u'I open the grafana URL') def step_impl(context): - """Login to grafana.""" + """Open grafana URL.""" context.behave_driver.get(context.grafana['url'])