@test.create_stubs({api.keystone: ('get_default_domain',
                                       'tenant_list',
                                       'get_default_role',
                                       'role_list',
                                       'user_list',
                                       'domain_lookup')})
    def test_modal_create_user_with_passwords_not_matching(self):
        domain = self._get_default_domain()

        api.keystone.get_default_domain(IgnoreArg()) \
            .MultipleTimes().AndReturn(domain)

        if api.keystone.VERSIONS.active >= 3:
            api.keystone.tenant_list(
                IgnoreArg(), domain=None).AndReturn(
                [self.tenants.list(), False])
        else:
            api.keystone.tenant_list(
                IgnoreArg(), user=None).AndReturn(
                [self.tenants.list(), False])

        api.keystone.role_list(IgnoreArg()).AndReturn(self.roles.list())
        api.keystone.user_list(IgnoreArg(), domain=None) \
            .AndReturn(self.users.list())
        api.keystone.domain_lookup(IgnoreArg()).AndReturn({None: None})
        api.keystone.get_default_role(IgnoreArg()) \
                    .AndReturn(self.roles.first())
        self.mox.ReplayAll()

        self.selenium.get("%s%s" % (self.live_server_url, USERS_INDEX_URL))

        # Open the modal menu
        self.selenium.find_element_by_id("users__action_create") \
                     .send_keys("\n")
        wait = self.ui.WebDriverWait(self.selenium, 10,
                                     ignored_exceptions=[socket_timeout])
        wait.until(lambda x: self.selenium.find_element_by_id("id_name"))

        self.assertFalse(self._is_element_present("id_confirm_password_error"),
                         "Password error element shouldn't yet exist.")
        self.selenium.find_element_by_id("id_name").send_keys("Test User")
        self.selenium.find_element_by_id("id_password").send_keys("test")
        self.selenium.find_element_by_id("id_confirm_password").send_keys("te")
        self.selenium.find_element_by_id("id_email").send_keys("a@b.com")

        wait.until(lambda x: self.selenium.find_element_by_id(
            "id_confirm_password_error"))

        self.assertTrue(self._is_element_present("id_confirm_password_error"),
                        "Couldn't find password error element.")
dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/identity/users/tests.py/SeleniumTests.test_modal_create_user_with_passwords_not_matching/original