Misuse of assertTrue in test scripts

Bug #1221517 reported by Zhongyue Luo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Low
Zhongyue Luo

Bug Description

cinder/tests/brick/test_brick_connector.py
- self.assertTrue(obj.__class__.__name__,
- "ISCSIConnector")

- self.assertTrue(obj.__class__.__name__,
- "FibreChannelConnector")

- self.assertTrue(obj.__class__.__name__,
- "AoEConnector")

- self.assertTrue(obj.__class__.__name__,
- "RemoteFsConnector")

- self.assertTrue(obj.__class__.__name__,
- "RemoteFsConnector")

cinder/tests/brick/test_brick_linuxscsi.py
- self.assertTrue(name, device_name)

All assertTrue should be assertEqual

Zhongyue Luo (zyluo)
Changed in cinder:
assignee: nobody → Zhongyue Luo (zyluo)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

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

Changed in cinder:
status: New → In Progress
Eric Harney (eharney)
Changed in cinder:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/45370
Committed: http://github.com/openstack/cinder/commit/b2e0f75ddaea0c12e154432da7a860725af8e344
Submitter: Jenkins
Branch: master

commit b2e0f75ddaea0c12e154432da7a860725af8e344
Author: Zhongyue Luo <email address hidden>
Date: Fri Sep 6 12:10:28 2013 +0800

    Fixes misuse of assertTrue in test scripts

    Misuse of assertTrue in places where assertEqual should be used.

    If assertTrue is used instead of assertEquals, the test will always pass
    if the first argument's boolean cast is True. The second argument
    passed to assertTrue() will be regarded as the error message
    when the assertion fails. Using assertEqual will actually check
    if two arguments are same value.

    Fixes bug #1221517

    Change-Id: I68f614164803729ea26e65f8868b0031e724d324

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
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.