Use self.assertTrue instead of self.assertEqual(..., True)

Bug #1230127 reported by Arnaud Legendre
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Bartosz Fic

Bug Description

$ find . -name '*.*' | xargs grep self.assertEqual | grep True

./tests/integration/legacy_functional/test_v1_api.py: self.assertEqual(data['image']['is_public'], True)
./tests/integration/legacy_functional/test_v1_api.py: self.assertEqual(data['image']['is_public'], True)
./tests/integration/legacy_functional/test_v1_api.py: self.assertEqual(data['image']['is_public'], True)
./tests/integration/legacy_functional/test_v1_api.py: self.assertEqual(response['x-image-meta-is_public'], 'True')
./tests/integration/legacy_functional/test_v1_api.py: self.assertEqual(data['image']['is_public'], True)
./tests/integration/legacy_functional/test_v1_api.py: self.assertEqual(data['image']['is_public'], True)
./tests/integration/legacy_functional/test_v1_api.py: self.assertEqual(data['image']['is_public'], True)
...
./tests/unit/test_swift_store.py: self.assertEqual(connection.insecure, True)
./tests/unit/test_swift_store.py: self.assertEquals(connection.snet, True)
./tests/unit/test_swift_store.py: self.assertEquals(connection.snet, True)

$ find . -name '*.*' | xargs grep self.assertTrue
./tests/unit/test_context_middleware.py: self.assertTrue(req.context.is_admin)
./tests/unit/test_context_middleware.py: self.assertTrue(req.context.is_admin)
...
./tests/unit/test_context_middleware.py: self.assertTrue(req.context.is_admin)
./tests/unit/test_context_middleware.py: self.assertTrue(req.context.read_only)
./tests/unit/test_context_middleware.py: self.assertTrue(req.context.is_admin)

The tests assertions need to be consistent: use assertTrue/assertFalse instead of assertEqual to test boolean values.

Changed in glance:
assignee: nobody → Miriam Godinez (miriamgc)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Changed in glance:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
Bartosz Fic (bartosz-fic) wrote :

Hi, What is the current status of this bug ? This code has negative reviews and has been abandoned. Also Jenkins failed. Is anybody working on this ?

Changed in glance:
assignee: Miriam Godinez (miriamgc) → Bartosz Fic (bartosz-fic)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
Bartosz Fic (bartosz-fic) wrote :

Hey,
I have written a code which resolves this bug in 11 files. Feel free to review :)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/121030
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=0b246bb5f561d694a4fa4f41c90811a64c05b9fb
Submitter: Jenkins
Branch: master

commit 0b246bb5f561d694a4fa4f41c90811a64c05b9fb
Author: Bartosz Fic <email address hidden>
Date: Fri Sep 12 10:49:16 2014 +0200

    Replaces assertEqual with assertTrue and assertFalse

    In order to improve coding practices and be aligned to a standard,
    self.assertEqual(...,True) statements where replaced with
    self.assertTrue and self.assertFalse.

    Change-Id: I4150a343493beae03d6f71c88e84f60d14fb60e1
    Closes-Bug: #1230127

Changed in glance:
status: In Progress → Fix Committed
Dolph Mathews (dolph)
Changed in glance:
milestone: none → juno-rc1
importance: Undecided → Low
Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: juno-rc1 → 2014.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.