Test for list_users in test_backend is not safe

Bug #1222574 reported by Henry Nash on 2013-09-08
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
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) on 2013-09-08
Changed in keystone:
assignee: nobody → Henry Nash (henry-nash)

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

Changed in keystone:
status: New → In Progress
Dolph Mathews (dolph) on 2013-09-09
Changed in keystone:
importance: Undecided → Low

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) on 2013-10-02
Changed in keystone:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in keystone:
milestone: havana-rc1 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers