

@test.create_stubs({
    api.keystone: ('domain_get', 'user_get', 'tenant_list'),
})
def test_update_validation_for_password_too_short(self):
    user = self.users.get(id='1')
    domain_id = user.domain_id
    domain = self.domains.get(id=domain_id)
    api.keystone.user_get(IsA(http.HttpRequest), '1', admin=True).AndReturn(user)
    api.keystone.domain_get(IsA(http.HttpRequest), domain_id).AndReturn(domain)
    api.keystone.tenant_list(IgnoreArg(), domain=domain_id, user=user.id).AndReturn([self.tenants.list(), False])
    self.mox.ReplayAll()
    formData = {
        'method': 'UpdateUserForm',
        'id': user.id,
        'name': user.name,
        'email': user.email,
        'password': 't',
        'project': self.tenant.id,
        'confirm_password': 't',
    }
    res = self.client.post(USER_UPDATE_URL, formData)
    self.assertFormError(res, 'form', 'password', ['Password must be between 8 and 18 characters.'])

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