WebUI: test_user: test if user is enabled by default

Test checks if the user is enabled, able to reset their password and
authentication types in both CA and CA-less environment.

Related: https://pagure.io/freeipa/issue/8203

Signed-off-by: Michal Polovka <mpolovka@redhat.com>
Reviewed-By: Michal Polovka <mpolovka@redhat.com>
Reviewed-By: Serhii Tsymbaliuk <stsymbal@redhat.com>
This commit is contained in:
Michal Polovka 2021-02-16 16:53:56 +01:00
parent 058a9c01c7
commit a0d11517f8
No known key found for this signature in database
GPG Key ID: 0F9B8D77BCABF90A

View File

@ -87,6 +87,30 @@ class user_tasks(UI_driver):
return data return data
def assert_user_auth_type(self, auth_type, enabled=True):
"""
Check if provided auth type is enabled or disabled for the user
:param auth_type: one of password, radius, otp, pkinit or hardened
:param enabled: check if enabled if True, check for disabled if False
"""
s_checkbox = 'div[name="ipauserauthtype"] input[value="{}"]'.format(
auth_type)
checkbox = self.find(s_checkbox, By.CSS_SELECTOR, strict=True)
assert checkbox.is_selected() == enabled
def add_user_auth_type(self, auth_type, save=False):
"""
Select user auth type
:param auth_type: one of password, radius, otp, pkinit or hardened
"""
s_checkbox = 'div[name="ipauserauthtype"] input[value="{}"]'.format(
auth_type)
checkbox = self.find(s_checkbox, By.CSS_SELECTOR, strict=True)
if not checkbox.is_selected():
checkbox.click()
if save:
self.facet_button_click('save')
@pytest.mark.tier1 @pytest.mark.tier1
class test_user(user_tasks): class test_user(user_tasks):
@ -677,6 +701,31 @@ class test_user(user_tasks):
# cleanup # cleanup
self.delete(user.ENTITY, [user.DATA2]) self.delete(user.ENTITY, [user.DATA2])
@screenshot
def test_enabled_by_default(self):
"""
Test if valid user created in both ca and
caless env is enabled by default.
https://pagure.io/freeipa/issue/8203
"""
self.init_app()
# check if the user is enabled
self.add_record(user.ENTITY, user.DATA, navigate=False)
self.assert_record_value(expected="Enabled",
pkeys=user.PKEY,
column="nsaccountlock")
self.navigate_to_record(user.PKEY)
self.assert_action_list_action("disable", visible=True, enabled=True)
self.assert_action_list_action("reset_password",
visible=True, enabled=True)
# add OTP authentication type and verify the change is persistent
self.add_user_auth_type("otp", save=True)
self.assert_user_auth_type("otp", enabled=True)
@pytest.mark.tier1 @pytest.mark.tier1
class test_user_no_private_group(UI_driver): class test_user_no_private_group(UI_driver):