functional-tests: Minor refactoring

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Joseph Nuthalapati 2020-01-24 22:30:13 +05:30 committed by Sunil Mohan Adapa
parent eab1e577b9
commit f10d763e6e
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -63,9 +63,13 @@ def get_app_checkbox_id(app_name):
return checkbox_id return checkbox_id
def install(browser, app_name): def _find_install_button(browser, app_name):
interface.nav_to_module(browser, get_app_module(app_name)) interface.nav_to_module(browser, get_app_module(app_name))
install = browser.find_by_css('.form-install input[type=submit]') return browser.find_by_css('.form-install input[type=submit]')
def install(browser, app_name):
install_button = _find_install_button(browser, app_name)
def install_in_progress(): def install_in_progress():
selectors = [ selectors = [
@ -89,15 +93,14 @@ def install(browser, app_name):
return return
wait_for_install() wait_for_install()
if install: if install_button:
install.click() install_button.click()
wait_for_install() wait_for_install()
sleep(2) # XXX This shouldn't be required. # sleep(2) # XXX This shouldn't be required.
def is_installed(browser, app_name): def is_installed(browser, app_name):
interface.nav_to_module(browser, get_app_module(app_name)) install_button = _find_install_button(browser, app_name)
install_button = browser.find_by_css('.form-install input[type=submit]')
return not bool(install_button) return not bool(install_button)
@ -410,8 +413,9 @@ def _gitweb_get_repo_url(repo, with_auth):
if with_auth: if with_auth:
password = config['DEFAULT']['password'] password = config['DEFAULT']['password']
return '{0}://{1}:{2}@{3}/gitweb/{4}'.format( return '{0}://{1}:{2}@{3}/gitweb/{4}'.format(scheme,
scheme, config['DEFAULT']['username'], password, url, repo) config['DEFAULT']['username'],
password, url, repo)
@contextlib.contextmanager @contextlib.contextmanager