From 68475668ea1ed80b981b4658331285dd3eac9b2e Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 20 Sep 2020 20:33:15 -0700 Subject: [PATCH] tests: functional: Simplify calling the login helper Signed-off-by: Sunil Mohan Adapa Reviewed-by: Joseph Nuthalapati --- plinth/tests/functional/__init__.py | 8 +++++++- plinth/tests/functional/step_definitions.py | 4 +--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plinth/tests/functional/__init__.py b/plinth/tests/functional/__init__.py index 9987eed8d..ec73a0be9 100644 --- a/plinth/tests/functional/__init__.py +++ b/plinth/tests/functional/__init__.py @@ -234,7 +234,13 @@ def _create_admin_account(browser, username, password): submit(browser) -def login(browser, url, username, password): +def login(browser): + """Login to the interface.""" + login_with_account(browser, base_url, config['DEFAULT']['username'], + config['DEFAULT']['password']) + + +def login_with_account(browser, url, username, password): # XXX: Find a way to remove the hardcoded jsxc URL if '/plinth/' not in browser.url or '/jsxc/jsxc' in browser.url: diff --git a/plinth/tests/functional/step_definitions.py b/plinth/tests/functional/step_definitions.py index 034c002af..76fc56984 100644 --- a/plinth/tests/functional/step_definitions.py +++ b/plinth/tests/functional/step_definitions.py @@ -13,9 +13,7 @@ from plinth.tests import functional @given("I'm a logged in user") def logged_in_user(session_browser): - functional.login(session_browser, functional.base_url, - functional.config['DEFAULT']['username'], - functional.config['DEFAULT']['password']) + functional.login(session_browser) @given("I'm a logged out user")