@test.create_stubs({api.keystone: ('user_update_enabled',
                                       'user_list',
                                       'domain_lookup')})
    def test_enable_disable_user_exception(self):
        domain = self._get_default_domain()
        domain_id = domain.id
        user = self.users.get(id="2")
        users = self._get_users(domain_id)
        user.enabled = False

        api.keystone.user_list(IgnoreArg(), domain=domain_id) \
            .AndReturn(users)
        api.keystone.user_update_enabled(IgnoreArg(), user.id, True) \
                    .AndRaise(self.exceptions.keystone)
        api.keystone.domain_lookup(IgnoreArg()).AndReturn({domain.id:
                                                           domain.name})
        self.mox.ReplayAll()

        formData = {'action': 'users__toggle__%s' % user.id}
        res = self.client.post(USERS_INDEX_URL, formData)

        self.assertRedirectsNoFollow(res, USERS_INDEX_URL)
dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/identity/users/tests.py/UsersViewTests.test_enable_disable_user_exception/original