cinder/cinder/tests/unit/objects
Gorka Eguileor 720f07f0d6 Create custom assertTrue and assertFalse
Python's unittest framework assertTrue and assertFalse methods don't
check that the provided value is False or True, like the documentation
says:

  Note that this is equivalent to bool(expr) is True and not to expr is
  True (use assertIs(expr, True) for the latter).

According to the documentation we should try to avoid using it as much
as possible:

  This method should also be avoided when more specific methods are
  available (e.g.  assertEqual(a, b) instead of assertTrue(a == b)),
  because they provide a better error message in case of failure.

But in our current code we keep abusing its use in many ways, among
which we can easily find the following:

- Thinking it only matches False/True

- assertTrue(expected, actual) --> This will always be true as long as
bool(expected) is True, because actual is interpreted as the message to
return on failure.

- Incorrectly testing values, like checking for a tuple of the form
(True, {...}) instead of testing for True in the first position.

This patch fixes incorrect some of the incorrect uses of the methods and
overwrites default methods so that they behave the way many people think
they do:

- assertTrue(x) == assertIs(True,x)
- assertFalse(x) == assertIs(False,x)

This will hopefully help us prevent incorrect usage of the methods.

Change-Id: I1e8c82702932e6b6d940bd83d0a2d4494576a81b
2017-09-11 18:31:20 +02:00
..
__init__.py Make c-vol use workers table for cleanup 2016-11-03 10:17:38 +01:00
test_backup.py Support metadata for backup resource 2017-07-26 14:23:58 +08:00
test_base.py Enable some off-by-default checks 2017-06-22 02:17:54 +00:00
test_cgsnapshot.py Update OVO instance on destroy method call 2016-07-22 17:54:00 +02:00
test_cleanable.py Prevent claiming and updating races on worker 2017-01-19 10:42:24 +01:00
test_cleanup_request.py Add cleanable base object and cleanup request VO 2016-10-04 15:17:31 +02:00
test_cluster.py Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
test_consistencygroup.py Remove cgsnapshot_id before snapshot.save 2016-12-03 16:23:43 -05:00
test_fields.py Add VolumeAttachStatus Enum 2016-11-09 17:10:27 -06:00
test_group.py Add group to cluster when init host 2017-07-12 14:08:43 +08:00
test_group_snapshot.py Use GroupSnapshotStatus enum field 2017-07-05 01:24:00 +00:00
test_group_type.py Add group type and group specs 2016-07-08 14:26:39 -04:00
test_manageable_volumes_snapshots.py Switch ManageableSnaphots & ManageableVolumes list to OVO 2017-01-25 00:41:30 +00:00
test_objects.py Support metadata for backup resource 2017-07-26 14:23:58 +08:00
test_qos.py Test: Fix assert_has_calls dict order bug (QoS) 2017-01-23 10:58:28 -05:00
test_service.py Add is_up property to service and cluster objects 2016-11-29 12:33:16 +02:00
test_snapshot.py Merge "Don't change volume's status when create backups from snapshots" 2017-03-28 14:09:24 +00:00
test_volume.py Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
test_volume_attachment.py Make attachment_update set status to attaching 2017-08-14 13:55:15 +00:00
test_volume_type.py Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00