

@test.create_stubs({
    api.keystone: ('get_default_domain', 'tenant_list', 'role_list', 'get_default_role'),
})
def test_create_with_password_mismatch(self):
    user = self.users.get(id='1')
    domain = self._get_default_domain()
    domain_id = domain.id
    api.keystone.get_default_domain(IgnoreArg()).MultipleTimes().AndReturn(domain)
    api.keystone.tenant_list(IgnoreArg(), domain=domain_id, user=None).AndReturn([self.tenants.list(), False])
    api.keystone.role_list(IgnoreArg()).AndReturn(self.roles.list())
    api.keystone.get_default_role(IgnoreArg()).AndReturn(self.roles.first())
    self.mox.ReplayAll()
    formData = {
        'method': 'CreateUserForm',
        'domain_id': domain_id,
        'name': user.name,
        'email': user.email,
        'password': user.password,
        'project': self.tenant.id,
        'role_id': self.roles.first().id,
        'confirm_password': 'doesntmatch',
    }
    res = self.client.post(USER_CREATE_URL, formData)
    self.assertFormError(res, 'form', None, ['Passwords do not match.'])

dataset/ETHPy150Open CiscoSystems/avos/openstack_dashboard/dashboards/identity/users/tests.py UsersViewTests.test_create_with_password_mismatch/original