

@test.create_stubs({
    api.keystone: ('user_list',),
})
def test_delete_user_with_improper_permissions(self):
    domain = self._get_default_domain()
    domain_id = domain.id
    users = self._get_users(domain_id)
    for i in range(0, 2):
        api.keystone.user_list(IgnoreArg(), domain=domain_id).AndReturn(users)
    self.mox.ReplayAll()
    formData = {
        'action': ('users__delete__%s' % self.request.user.id),
    }
    res = self.client.post(USERS_INDEX_URL, formData, follow=True)
    self.assertEqual(list(res.context['messages'])[0].message, ('You are not allowed to delete user: %s' % self.request.user.username))

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