Replace 'assertEqual(None, ...)' with 'assertIsNone(...)'

[H203] Use assertIs(Not)None to check for None (off by default) Unit
test assertions tend to give better messages for more specific
assertions. As a result, assertIsNone(...) is preferred over
assertEqual(None, ...) and assertIs(None, ...), and assertIsNotNone(...)
is preferred over assertNotEqual(None, ...) and assertIsNot(None,
...). Off by default.

More details, see:
http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises

Trivial fix.

Change-Id: Icd268b96dea5e5bb9bd344f597dfcd9cc82253f0
This commit is contained in:
howardlee 2016-11-18 15:26:14 +08:00
parent 5a620f83e8
commit 12d42efad2

View File

@ -174,7 +174,7 @@ class TestPlugin(TestDataNoAccount, unittest.TestCase):
auth_plugin = authv1.PasswordPlugin(**self.options)
self.mock_response.headers['X-Auth-Token-Expires'] = 'foo'
access = auth_plugin.get_access(self.mock_session)
self.assertEqual(None, access.expires)
self.assertIsNone(access.expires)
self.assertIs(False, access.will_expire_soon(60))
self.assertIs(False, access.will_expire_soon(1e20))