Browse Source

Modify assert statement when comparing with None

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

Change-Id: Iad1dee48bdb35b338e7b18bfb76c7f5e561c3790
Closes-Bug: #1280522
tags/3.0.0.0b1^2
sharat.sharma 3 years ago
parent
commit
77d9f412d2

+ 1
- 1
designate/tests/test_api/test_v2/test_service_status.py View File

@@ -77,7 +77,7 @@ class ApiV2ServiceStatusTest(ApiV2TestCase):
77 77
                         response.json['capabilities'])
78 78
         self.assertEqual(fixture['stats'], response.json['stats'])
79 79
         self.assertEqual(fixture['status'], response.json['status'])
80
-        self.assertEqual(None, response.json['heartbeated_at'])
80
+        self.assertIsNone(response.json['heartbeated_at'])
81 81
 
82 82
     def test_get_service_status_invalid_id(self):
83 83
         self.policy({'find_service_status': '@'})

+ 1
- 1
designate/tests/unit/test_agent/test_backends/test_knot2.py View File

@@ -158,7 +158,7 @@ class Knot2AgentBackendUnitTestCase(TestCase):
158 158
         mock_exe.side_effect = ProcessExecutionError(
159 159
             "error: [example.com.] (no such zone found)")
160 160
         serial = self.kb.find_zone_serial('example.com')
161
-        self.assertEqual(None, serial)
161
+        self.assertIsNone(serial)
162 162
 
163 163
     @mock.patch('designate.backend.agent_backend.impl_knot2.execute')
164 164
     def test_find_zone_serial_unexpected_output(self, mock_exe):

+ 3
- 3
designate/tests/unit/test_backend/test_agent.py View File

@@ -65,7 +65,7 @@ class BackendAgentTest(base.BaseTestCase):
65 65
 
66 66
         self.agent._make_and_send_dns_message.assert_called_with(
67 67
             'zn', 1, 14, pcodes.CREATE, pcodes.SUCCESS, 2, 3)
68
-        self.assertEqual(None, out)
68
+        self.assertIsNone(out)
69 69
 
70 70
     def test_create_zone_exception(self, *mock):
71 71
         self.agent._make_and_send_dns_message = Mock(return_value=(None, 2))
@@ -84,7 +84,7 @@ class BackendAgentTest(base.BaseTestCase):
84 84
 
85 85
         self.agent.mdns_api.notify_zone_changed.assert_called_with(
86 86
             'ctx', zone, 2, 3, 1, 4, 5, 6)
87
-        self.assertEqual(None, out)
87
+        self.assertIsNone(out)
88 88
 
89 89
     def test_delete_zone(self, *mock):
90 90
         self.agent._make_and_send_dns_message = Mock(return_value=(1, 2))
@@ -93,7 +93,7 @@ class BackendAgentTest(base.BaseTestCase):
93 93
 
94 94
         self.agent._make_and_send_dns_message.assert_called_with(
95 95
             'zn', 1, 14, pcodes.DELETE, pcodes.SUCCESS, 2, 3)
96
-        self.assertEqual(None, out)
96
+        self.assertIsNone(out)
97 97
 
98 98
     def test_delete_zone_exception(self, *mock):
99 99
         self.agent._make_and_send_dns_message = Mock(return_value=(None, 2))

+ 1
- 1
designate/tests/unit/test_mdns/test_handler.py View File

@@ -120,7 +120,7 @@ class TestRequestHandlerCall(unittest.TestCase):
120 120
         )
121 121
 
122 122
         r_rrset = self.handler._convert_to_rrset(zone, recordset)
123
-        self.assertEqual(None, r_rrset)
123
+        self.assertIsNone(r_rrset)
124 124
 
125 125
     def test__convert_to_rrset(self):
126 126
         zone = objects.Zone.from_dict({'ttl': 1234})

Loading…
Cancel
Save