From e87752e065820160ef0f134ee1f992ff3e6ef3a5 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 30 Aug 2022 22:36:09 -0700 Subject: [PATCH] users: tests: functional: Find forms more accurately Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- .../modules/users/templates/users_change_password.html | 2 +- plinth/modules/users/templates/users_create.html | 2 +- plinth/modules/users/templates/users_delete.html | 2 +- plinth/modules/users/templates/users_firstboot.html | 4 ++-- plinth/modules/users/templates/users_update.html | 2 +- plinth/modules/users/tests/test_functional.py | 10 +++++----- plinth/tests/functional/__init__.py | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/plinth/modules/users/templates/users_change_password.html b/plinth/modules/users/templates/users_change_password.html index 5393b9d84..0bf0f1828 100644 --- a/plinth/modules/users/templates/users_change_password.html +++ b/plinth/modules/users/templates/users_change_password.html @@ -12,7 +12,7 @@ Change Password for {{ username }} {% endblocktrans %} -
+ {% csrf_token %} {{ form|bootstrap }} diff --git a/plinth/modules/users/templates/users_create.html b/plinth/modules/users/templates/users_create.html index 53e2dc4da..853f7103a 100644 --- a/plinth/modules/users/templates/users_create.html +++ b/plinth/modules/users/templates/users_create.html @@ -10,7 +10,7 @@

{%trans "Create User" %}

- + {% csrf_token %} {{ form|bootstrap }} diff --git a/plinth/modules/users/templates/users_delete.html b/plinth/modules/users/templates/users_delete.html index 147e2252c..14b40f648 100644 --- a/plinth/modules/users/templates/users_delete.html +++ b/plinth/modules/users/templates/users_delete.html @@ -16,7 +16,7 @@ {% endblocktrans %}

- + {% csrf_token %} - + {% csrf_token %} {{ form|bootstrap }} @@ -56,7 +56,7 @@ {% endblocktrans %}

- + {% csrf_token %} - + {% csrf_token %} {{ form|bootstrap }} diff --git a/plinth/modules/users/tests/test_functional.py b/plinth/modules/users/tests/test_functional.py index 467b18c5c..063c7f548 100644 --- a/plinth/modules/users/tests/test_functional.py +++ b/plinth/modules/users/tests/test_functional.py @@ -251,7 +251,7 @@ def _rename_user(browser, old_name, new_name): '/edit/').first.click() browser.find_by_id('id_username').fill(new_name) browser.find_by_id('id_confirm_password').fill(_admin_password) - functional.submit(browser) + functional.submit(browser, form_class='form-update') def _set_language(browser, language_code): @@ -260,7 +260,7 @@ def _set_language(browser, language_code): browser.find_by_xpath('//select[@id="id_language"]//option[@value="' + language_code + '"]').first.click() browser.find_by_id('id_confirm_password').fill(_admin_password) - functional.submit(browser) + functional.submit(browser, form_class='form-update') def _check_language(browser, language_code): @@ -294,14 +294,14 @@ def _set_ssh_keys(browser, ssh_keys, username=None): browser.find_by_id('id_ssh_keys').fill(ssh_keys) browser.find_by_id('id_confirm_password').fill(auth_password) - functional.submit(browser) + functional.submit(browser, form_class='form-update') def _set_user_inactive(browser, username): functional.visit(browser, '/plinth/sys/users/{}/edit/'.format(username)) browser.find_by_id('id_is_active').uncheck() browser.find_by_id('id_confirm_password').fill(_admin_password) - functional.submit(browser) + functional.submit(browser, form_class='form-update') def _change_password(browser, new_password, current_password=None, @@ -319,7 +319,7 @@ def _change_password(browser, new_password, current_password=None, browser.find_by_id('id_new_password1').fill(new_password) browser.find_by_id('id_new_password2').fill(new_password) browser.find_by_id('id_confirm_password').fill(auth_password) - functional.submit(browser) + functional.submit(browser, form_class='form-change-password') def _try_login_to_ssh(key_file=None): diff --git a/plinth/tests/functional/__init__.py b/plinth/tests/functional/__init__.py index 4f79738ad..5fec4bfe1 100644 --- a/plinth/tests/functional/__init__.py +++ b/plinth/tests/functional/__init__.py @@ -253,7 +253,7 @@ def _create_admin_account(browser, username, password): browser.find_by_id('id_username').fill(username) browser.find_by_id('id_password1').fill(password) browser.find_by_id('id_password2').fill(password) - submit(browser) + submit(browser, form_class='form-create') def login(browser): @@ -604,7 +604,7 @@ def create_user(browser, name, password=None, groups=[]): browser.find_by_id('id_confirm_password').fill( config['DEFAULT']['password']) - submit(browser) + submit(browser, form_class='form-create') def delete_user(browser, name): @@ -615,7 +615,7 @@ def delete_user(browser, name): with wait_for_page_update(browser): delete_link.first.click() - submit(browser) + submit(browser, form_class='form-delete') def user_exists(browser, name):