Browse Source

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: Ic2dca04e7cdd4f837c42b39dd1ce37604c8f101b
Closes-bug: #1280522
tags/1.4.2
Shuquan Huang 3 years ago
parent
commit
e4503e43cb
1 changed files with 3 additions and 4 deletions
  1. 3
    4
      heat_cfntools/tests/test_cfn_helper.py

+ 3
- 4
heat_cfntools/tests/test_cfn_helper.py View File

@@ -823,8 +823,7 @@ class TestCfnHelper(testtools.TestCase):
823 823
 
824 824
     def test_metadata_server_nofile(self):
825 825
         random_filename = self.getUniqueString()
826
-        self.assertEqual(None,
827
-                         cfn_helper.metadata_server_port(random_filename))
826
+        self.assertIsNone(cfn_helper.metadata_server_port(random_filename))
828 827
 
829 828
     def test_to_boolean(self):
830 829
         self.assertTrue(cfn_helper.to_boolean(True))
@@ -1171,7 +1170,7 @@ class TestMetadataRetrieve(testtools.TestCase):
1171 1170
             mock_popen.side_effect = write_cache_file
1172 1171
             md = cfn_helper.Metadata('teststack', None)
1173 1172
             meta_out = md.get_nova_meta(cache_path=cache_path)
1174
-            self.assertEqual(None, meta_out)
1173
+            self.assertIsNone(meta_out)
1175 1174
             mock_popen.assert_has_calls(
1176 1175
                 popen_root_calls([['curl', '-o', cache_path, url]]))
1177 1176
 
@@ -1190,7 +1189,7 @@ class TestMetadataRetrieve(testtools.TestCase):
1190 1189
             mock_popen.return_value = FakePOpen('Failed', '', 1)
1191 1190
             md = cfn_helper.Metadata('teststack', None)
1192 1191
             meta_out = md.get_nova_meta(cache_path=cache_path)
1193
-            self.assertEqual(None, meta_out)
1192
+            self.assertIsNone(meta_out)
1194 1193
             mock_popen.assert_has_calls(
1195 1194
                 popen_root_calls([['curl', '-o', cache_path, url]]))
1196 1195
 

Loading…
Cancel
Save