cinder/cinder/tests/unit
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
..
api Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
attachments Make attachment_update set status to attaching 2017-08-14 13:55:15 +00:00
backup cinder backup sets incorrect parent_id 2017-07-26 23:03:05 -04:00
brick Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
compute Add ability to extend 'in-use' volume 2017-07-12 11:48:32 -04:00
consistencygroup Remove unused CG code 2017-03-19 00:49:10 -04:00
db Trivial fix PEP 8 coding style violation and typo 2017-05-03 19:47:22 +07:00
glance Files with no code must be left completely empty 2016-09-28 16:29:30 +07:00
group Adding project id check 2017-09-10 06:09:20 -05:00
image Fix image cache db query when limits are enabled 2017-06-30 11:22:19 -07:00
keymgr Implement keymgr list() method 2017-09-07 07:27:48 -05:00
message Merge "Explicit user messages" 2017-06-23 19:29:31 +00:00
monkey_patch_example
objects Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
scheduler Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
targets Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
volume Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
windows Merge "SMBFS: enable thin provisioning support flag" 2017-08-18 14:23:10 +00:00
zonemanager Merge "Cisco zonemanager: fix create multi-fabric zones" 2017-09-05 15:05:59 +00:00
__init__.py Remove nosetests i18n fix 2016-11-29 18:16:59 +02:00
cast_as_call.py
conf_fixture.py Move driver options to "backend_defaults" section 2017-07-03 16:42:03 +02:00
fake_cluster.py Update Versioned Objects with Cluster object 2016-07-22 21:00:08 +02:00
fake_constants.py Update db from drivers in default groups methods 2017-03-17 11:08:06 -04:00
fake_group.py Update db from drivers in default groups methods 2017-03-17 11:08:06 -04:00
fake_group_snapshot.py Update db from drivers in default groups methods 2017-03-17 11:08:06 -04:00
fake_notifier.py Short-circuit notifications when not enabled 2017-01-30 12:31:45 +01:00
fake_objects.py
fake_service.py Update is_up from Service OVO class to match ORM 2016-12-21 20:55:37 +01:00
fake_snapshot.py Add volume to fake snapshot object 2017-01-17 16:55:44 +05:30
fake_utils.py Remove unused function from unit/fake_utils.py 2016-08-30 15:09:58 +07:00
fake_volume.py Add get_all capability to volume_attachments 2016-12-16 14:25:21 -07:00
policy.json Merge "Make VolumeTypeExtraSpecsController policy more granular" 2017-07-16 00:11:44 +00:00
test_api.py
test_api_urlmap.py Replace use of mox with mock in test_api_urlmap 2016-07-01 17:17:44 +03:00
test_cleanable_manager.py Make c-vol use workers table for cleanup 2016-11-03 10:17:38 +01:00
test_cmd.py Use newer location for iso8601 UTC 2017-09-08 07:38:35 -05:00
test_context.py Refactor internal context testcases with ddt 2017-05-12 16:48:59 +08:00
test_coordination.py coordination: use tooz builtin heartbeat feature 2017-07-19 07:17:50 -04:00
test_db_api.py Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
test_db_worker_api.py Prevent claiming and updating races on worker 2017-01-19 10:42:24 +01:00
test_evaluator.py
test_exception.py Extracted HTTP response codes to constants 2017-05-26 17:07:06 +05:30
test_fixtures.py
test_hacking.py Update log translation hacking rule 2017-06-29 04:05:52 -04:00
test_image_utils.py Merge "Mapping parallel and ploop" 2017-08-01 19:16:44 +00:00
test_manager.py Add service dynamic log change/query 2017-05-16 13:37:35 +02:00
test_migrations.py Don't lock whole project's resource when reserve/commit 2017-08-30 12:59:14 +00:00
test_paginate_query.py Don't use None value for sql query. 2017-02-04 09:31:27 +08:00
test_qos_specs.py Add input format check for qos_spec update 2017-08-18 09:01:22 +08:00
test_quota.py Don't lock whole project's resource when reserve/commit 2017-08-30 12:59:14 +00:00
test_quota_utils.py Cinder consistency group returning generic error message 2016-12-21 12:52:06 +08:00
test_rpc.py Fix notification short-circuit 2017-02-01 17:11:14 +01:00
test_service.py Make Replication support Active-Active 2017-01-19 10:42:18 +01:00
test_setup_profiler.py Support new osprofiler API 2016-12-15 15:46:56 +07:00
test_ssh_utils.py Fix SSHPool current_size not work correctly 2017-07-11 10:58:20 +08:00
test_test.py Fix test_rpc_consumer_isolation for oslo.messaging 5.31.0 2017-09-06 15:12:45 -04:00
test_test_utils.py Tests: Disallow use of assertTrue(str) 2017-06-15 12:09:52 -04:00
test_utils.py Merge "Windows: case insensitive path comparisons" 2017-06-27 02:19:35 +00:00
test_volume_cleanup.py Clean up image tmp file if c-vol gets restarted 2017-01-17 17:28:39 +08:00
test_volume_configuration.py Add support for shared "backend_defaults" config 2017-07-11 18:58:58 +00:00
test_volume_glance_metadata.py
test_volume_throttling.py
test_volume_transfer.py Remove race conditions from transfer API 2016-11-09 11:00:42 -06:00
test_volume_types.py Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
test_volume_types_extra_specs.py
test_volume_utils.py Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
utils.py Fix host and cluster_name filter for snapshot list 2017-08-03 17:28:52 +08:00