#8629 NIghtly test failure (master) in test_webui/test_user.py::test_user::test_add_user_special
Closed: fixed by abbra. Opened by frenaud.

The nightly test test_webui/test_user.py::test_user::test_add_user_special started failing after commit 809d9cb: Allow leading/trailing whitespaces in passwords

See for instance PR #598 with the following report and logs:

self = <ipatests.test_webui.test_user.test_user object at 0x7f2737243910>
    @screenshot
    def test_add_user_special(self):
        """
        Test various add user special cases
        """
        self.init_app()
        # Test invalid characters (#@*?) in login
        self.navigate_to_entity(user.ENTITY)
        self.facet_button_click('add')
        self.fill_textbox('uid', 'itest-user#')
        self.assert_field_validation(ERR_INCLUDE)
        self.fill_textbox('uid', 'itest-user@')
        self.assert_field_validation(ERR_INCLUDE)
        self.fill_textbox('uid', 'itest-user*')
        self.assert_field_validation(ERR_INCLUDE)
        self.fill_textbox('uid', 'itest-user?')
        self.assert_field_validation(ERR_INCLUDE)
        self.dialog_button_click('cancel')
        # Add an user with special chars
        self.basic_crud(user.ENTITY, user.DATA_SPECIAL_CHARS)
        # Add an user with long login (should FAIL)
        self.add_record(user.ENTITY, user.DATA_LONG_LOGIN, negative=True)
        self.assert_last_error_dialog(expected_err=LONG_LOGIN)
        self.close_all_dialogs()
        # Test password mismatch
        self.add_record(user.ENTITY, user.DATA_PASSWD_MISMATCH, negative=True)
        pass_e = self.find('.widget[name="userpassword2"]', By.CSS_SELECTOR)
        self.assert_field_validation(ERR_MISMATCH, parent=pass_e)
        self.dialog_button_click('cancel')
        self.assert_record(user.DATA_PASSWD_MISMATCH.get('pkey'),
                           negative=True)
        # test add and edit record
        self.add_record(user.ENTITY, user.DATA2, dialog_btn='add_and_edit')
        self.action_list_action('delete_active_user')
        # click add and cancel
        self.add_record(user.ENTITY, user.DATA, dialog_btn='cancel')
        # add leading space before password (should FAIL)
        self.navigate_to_entity(user.ENTITY)
        self.facet_button_click('add')
        self.fill_fields(user.DATA_PASSWD_LEAD_SPACE['add'])
        self.dialog_button_click('add')
>       self.assert_last_error_dialog(INV_PASSWD)
test_webui/test_user.py:516: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test_webui/ui_driver.py:2352: in assert_last_error_dialog
    self.assert_text(s, expected_err, parent=err_dialog)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <ipatests.test_webui.test_user.test_user object at 0x7f2737243910>
selector = '.modal-body div p'
value = "invalid 'password': Leading and trailing spaces are not allowed"
parent = None
    def assert_text(self, selector, value, parent=None):
        """
        Assert read-only text value in details page or in a form
        """
        text = self.get_text(selector, parent)
        text = text.strip()
        value = value.strip()
>       assert text == value, "Invalid value: '%s' Expected: %s" % (text, value)
E       AssertionError: Invalid value: '' Expected: invalid 'password': Leading and trailing spaces are not allowed
test_webui/ui_driver.py:2043: AssertionError

The test is creating a user password with leading space and expects an error but needs to be adapted because the password should now be accepted.


@atorresm Could you have a look and fix the test? Thanks.

This is addressed by https://github.com/freeipa/freeipa/pull/5369

Metadata Update from @abbra:
- Issue assigned to abbra

master:

  • 2c98105cf2cdfe6cf9cf62aa9ebc7cd0b297c4ff tests_webui: flip leading and trailing space password test
  • 705f564eb6203e2aa1de4049057f54000227e3cd tests_webui: fix wrong user name key for trail space case

ipa-4-9:

  • d9bdd3e93048ff4f08c2d53f1fd89b05dcd7861c tests_webui: flip leading and trailing space password test
  • 7d13d704b9552ab8ec1c7c5428655297fbdbf09c tests_webui: fix wrong user name key for trail space case

Metadata Update from @abbra:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata