glance/tests/functional/test_api.py tests expected values against expected values

Bug #829654 reported by Kevin L. Mitchell
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Justin Shepherd

Bug Description

Take a close look around line 197:

        image = json.loads(content)

        for expected_key, expected_value in expected_image.items():
            self.assertEqual(expected_value, expected_image[expected_key],
                            "For key '%s' expected header value '%s'. Got '%s'"
                            % (expected_key,
                               expected_value,
                               image['images'][0][expected_key]))

The assertion is verifying that expected_value == expected_value, which will of course always be true. The second argument to assertEqual() should probably be "image['images'][0][expected_key]" instead. This same error occurs in identical code around line 238. The logic of all the tests in the functional suite should probably be carefully scrutinized to ensure that it does not occur elsewhere...

summary: - glance/tests/functional/test_api.py
+ glance/tests/functional/test_api.py tests expected values against
+ expected values
Jay Pipes (jaypipes)
Changed in glance:
status: New → Triaged
importance: Undecided → High
milestone: none → diablo-4
Revision history for this message
Justin Shepherd (jshepher) wrote :
Changed in glance:
assignee: nobody → Justin Shepherd (jshepher)
status: Triaged → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : A change has been merged to openstack/glance

Reviewed: https://review.openstack.org/331
Committed: http://github.com/openstack/glance/commit/57cbac057028537fca5af4ed8ffaea4be67e8c64
Submitter: Jenkins
Branch: master

 status fixcommitted
 done

commit 57cbac057028537fca5af4ed8ffaea4be67e8c64
Author: Justin Shepherd <email address hidden>
Date: Wed Aug 24 09:29:58 2011 -0500

    Bug lp:829654

    Assert was not actually validating return data from api query.

    Change-Id: I2db2863c749bfabba201ae2d733330b7a71bef2d

Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote :

Reviewed: https://review.openstack.org/344
Committed: http://github.com/openstack/glance/commit/757d712bd58fc5c1342011ab81b2eda7460d6d50
Submitter: Jenkins
Branch: milestone-proposed

 status fixcommitted
 done

commit 757d712bd58fc5c1342011ab81b2eda7460d6d50
Author: Justin Shepherd <email address hidden>
Date: Wed Aug 24 09:29:58 2011 -0500

    Bug lp:829654

    Assert was not actually validating return data from api query.

    Change-Id: I2db2863c749bfabba201ae2d733330b7a71bef2d

Thierry Carrez (ttx)
Changed in glance:
milestone: diablo-4 → 2011.3
status: Fix Committed → Fix Released
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.