Replace assertEqual(None, *) with assertIsNone in tests

Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.

Change-Id: I7ea0306009e8fdde468c1394615972de4d296f45
Closes-Bug:#1280522
changes/01/210801/1
Yusuke Hayashi 7 years ago
parent 03542ee65a
commit 780a1299cb
  1. 4
      cinderclient/tests/unit/test_shell.py
  2. 2
      cinderclient/tests/unit/v2/test_consistencygroups.py
  3. 2
      cinderclient/tests/unit/v2/test_volumes.py

@ -113,14 +113,14 @@ class ShellTest(utils.TestCase):
v2_url, v3_url = _shell._discover_auth_versions(
None, auth_url=os_auth_url)
self.assertEqual(v2_url, os_auth_url, "Expected v2 url")
self.assertEqual(v3_url, None, "Expected no v3 url")
self.assertIsNone(v3_url, "Expected no v3 url")
os_auth_url = "https://DiscoveryNotSupported.discovery.com:35357/v3.0"
self.register_keystone_auth_fixture(mocker, os_auth_url)
v2_url, v3_url = _shell._discover_auth_versions(
None, auth_url=os_auth_url)
self.assertEqual(v3_url, os_auth_url, "Expected v3 url")
self.assertEqual(v2_url, None, "Expected no v2 url")
self.assertIsNone(v2_url, "Expected no v2 url")
@mock.patch('sys.stdin', side_effect=mock.MagicMock)
@mock.patch('getpass.getpass', return_value='password')

@ -89,7 +89,7 @@ class ConsistencygroupsTest(utils.TestCase):
cs.assert_called('PUT', '/consistencygroups/1234', body=expected)
def test_update_consistencygroup_none(self):
self.assertEqual(None, cs.consistencygroups.update('1234'))
self.assertIsNone(cs.consistencygroups.update('1234'))
def test_update_consistencygroup_no_props(self):
cs.consistencygroups.update('1234')

@ -235,7 +235,7 @@ class FormatSortParamTestCase(utils.TestCase):
def test_format_sort_empty_input(self):
for s in [None, '', []]:
self.assertEqual(None, cs.volumes._format_sort_param(s))
self.assertIsNone(cs.volumes._format_sort_param(s))
def test_format_sort_string_single_key(self):
s = 'id'

Loading…
Cancel
Save