cinder/cinder/tests/unit/volume
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
..
drivers Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
flows Merge "cleanup cg field when create image cache volume" 2017-08-31 16:06:25 +00:00
__init__.py Fix volume retype with migration as non-admin 2017-02-15 17:31:59 -02:00
test_availability_zone.py Refresh az cache if target az is not found in cache 2017-08-03 17:24:02 +08:00
test_capabilities.py Trivial fix typos 2017-05-17 10:57:40 +07:00
test_connection.py Explicit user messages 2017-06-16 14:35:24 +08:00
test_driver.py Add support for OS-Brick force disconnect 2017-07-19 19:43:29 +02:00
test_image.py Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
test_init_host.py Add group to cluster when init host 2017-07-12 14:08:43 +08:00
test_manage_volume.py [3/11] Refactor test_volume file 2017-02-08 23:38:23 +00:00
test_policy.py [1/11] Refactor test_volume file 2017-02-08 17:05:15 +00:00
test_replication_manager.py Tiramisu: Add groups param to failover_host 2017-07-10 09:30:13 -07:00
test_rpcapi.py Add service dynamic log change/query 2017-05-16 13:37:35 +02:00
test_snapshot.py Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
test_volume.py Fix allocated capacity report on non pool drivers 2017-08-25 15:45:51 +02:00
test_volume_migration.py Fix: SnapshotStatus missing in Cinder 2017-03-15 10:38:43 +08:00
test_volume_usage_audit.py [5/11] Refactor test_volume file 2017-02-08 23:38:42 +00:00