cinder/cinder
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 Merge "Fix 'fix_allocated_quotas' doesn't work when validate setup" 2017-09-08 18:47:28 +00:00
backup Deprecate service-to-driver mapping for backups 2017-09-06 13:41:36 +03:00
brick LVM: Activate LV before creating exports 2017-07-21 11:22:31 -04:00
cmd Use newer location for iso8601 UTC 2017-09-08 07:38:35 -05:00
common Remove API v1 2017-09-06 07:39:10 -05:00
compute [DOC BLD FIX] Fix formatting in cinder.compute.nova 2017-07-17 16:09:06 -05:00
consistencygroup Merge "Add quota limit check and enhance roll back for cg create" 2017-03-20 13:13:08 +00:00
db Support az filter for snapshot 2017-09-07 10:25:58 +08:00
group Adding project id check 2017-09-10 06:09:20 -05:00
hacking Add contributor doc on assertEqual vs assertFalse 2017-08-30 17:50:02 +00:00
image Modify some spelling mistakes in cinder 2017-08-25 04:17:54 -07:00
interface Merge "Add driver interface documentation for list manageable" 2017-08-16 02:33:29 +00:00
keymgr Implement keymgr list() method 2017-09-07 07:27:48 -05:00
locale Imported Translations from Zanata 2016-10-15 07:34:30 +00:00
message Fix typo in message for volume creation failure 2017-07-27 14:14:04 -04:00
objects Merge "Fix grammatical mistake, Changed character from "a" to "an"" 2017-08-23 15:55:18 +00:00
scheduler Merge "Fix wrong param transfer in scheduler flows" 2017-09-01 14:30:08 +00:00
tests Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
transfer Trivial fix typos while reading code 2017-05-04 10:27:57 +07:00
volume Merge "IBM XIV: Fix ordered use of a dict" 2017-09-11 09:36:03 +00:00
wsgi Remove unused logging import and LOG global var 2016-05-20 17:17:38 +08:00
zonemanager Merge "Cisco zonemanager: fix create multi-fabric zones" 2017-09-05 15:05:59 +00:00
__init__.py Set EVENTLET_NO_GREENDNS for IPv6 and dnspython compat 2016-11-11 13:19:07 -06:00
context.py Remove log translations 2017-03-19 14:59:57 +00:00
coordination.py coordination: use tooz builtin heartbeat feature 2017-07-19 07:17:50 -04:00
exception.py Merge "Fix message format for VolumeAttachmentNotFound exception" 2017-08-07 23:58:32 +00:00
flow_utils.py Fix logging traceback in service logs 2016-12-20 12:39:07 +05:30
i18n.py Update the documentation link 2017-08-23 16:42:00 +08:00
manager.py Remove periodic_tasks method from base manager 2017-07-06 12:26:40 +03:00
opts.py Remove unsupported BlockDeviceDriver 2017-09-05 17:19:45 +03:00
policy.py Use to_policy_values for enforcing policy 2016-09-13 01:13:15 +00:00
quota.py Periodic task to clean expired reservation 2017-05-30 22:21:38 +08:00
quota_utils.py Add Generic Volume Group Into Quota Management 2017-05-26 01:43:23 +00:00
rpc.py Remove deprecated oslo_messaging.get_transport 2017-06-13 14:25:38 +07:00
service.py Remove periodic_tasks method from base manager 2017-07-06 12:26:40 +03:00
ssh_utils.py Fix SSHPool current_size not work correctly 2017-07-11 10:58:20 +08:00
test.py Create custom assertTrue and assertFalse 2017-09-11 18:31:20 +02:00
utils.py Stop using internal `oslo_log.log._loggers` dict 2017-08-24 18:24:00 +02:00
version.py