Test for list_users in test_backend is not safe

Bug #1222574 reported by Henry Nash
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Low
Henry Nash

Bug Description

The test for list_users in test_backend is written as:

    def test_list_users(self):
        users = self.identity_api.list_users()
        for test_user in default_fixtures.USERS:
            self.assertTrue(x for x in users if x['id'] == test_user['id'])

This is not safe. You can show this by, for instance, setting users = [] instead of the correct result from self.identity_api.list_users() and no asset is raised

Henry Nash (henry-nash)
Changed in keystone:
assignee: nobody → Henry Nash (henry-nash)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/45591

Changed in keystone:
status: New → In Progress
Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/45591
Committed: http://github.com/openstack/keystone/commit/2d9cdceadaca5ce44d7ae14c5371e2326128df64
Submitter: Jenkins
Branch: master

commit 2d9cdceadaca5ce44d7ae14c5371e2326128df64
Author: Henry Nash <email address hidden>
Date: Mon Sep 9 00:11:35 2013 +0100

    Fix incorrect test for list_users

    The current test would not fail if incorrect data was returned by
    the driver. The list_roles test also has the same issue.

    Fixes bug 1222574

    Change-Id: Icc5e76e9453436ac208c5f262d0dd4082b700d02

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: havana-rc1 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.