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
changes/64/319864/3
sharat.sharma 6 years ago committed by Sharat Sharma
parent a8f14f6e55
commit 77d9f412d2
  1. 2
      designate/tests/test_api/test_v2/test_service_status.py
  2. 2
      designate/tests/unit/test_agent/test_backends/test_knot2.py
  3. 6
      designate/tests/unit/test_backend/test_agent.py
  4. 2
      designate/tests/unit/test_mdns/test_handler.py

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

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

@ -65,7 +65,7 @@ class BackendAgentTest(base.BaseTestCase):
self.agent._make_and_send_dns_message.assert_called_with(
'zn', 1, 14, pcodes.CREATE, pcodes.SUCCESS, 2, 3)
self.assertEqual(None, out)
self.assertIsNone(out)
def test_create_zone_exception(self, *mock):
self.agent._make_and_send_dns_message = Mock(return_value=(None, 2))
@ -84,7 +84,7 @@ class BackendAgentTest(base.BaseTestCase):
self.agent.mdns_api.notify_zone_changed.assert_called_with(
'ctx', zone, 2, 3, 1, 4, 5, 6)
self.assertEqual(None, out)
self.assertIsNone(out)
def test_delete_zone(self, *mock):
self.agent._make_and_send_dns_message = Mock(return_value=(1, 2))
@ -93,7 +93,7 @@ class BackendAgentTest(base.BaseTestCase):
self.agent._make_and_send_dns_message.assert_called_with(
'zn', 1, 14, pcodes.DELETE, pcodes.SUCCESS, 2, 3)
self.assertEqual(None, out)
self.assertIsNone(out)
def test_delete_zone_exception(self, *mock):
self.agent._make_and_send_dns_message = Mock(return_value=(None, 2))

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

Loading…
Cancel
Save