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
This commit is contained in:
sharat.sharma 2016-05-23 17:09:12 +05:30 committed by Sharat Sharma
parent a8f14f6e55
commit 77d9f412d2
4 changed files with 6 additions and 6 deletions

View File

@ -77,7 +77,7 @@ class ApiV2ServiceStatusTest(ApiV2TestCase):
response.json['capabilities']) response.json['capabilities'])
self.assertEqual(fixture['stats'], response.json['stats']) self.assertEqual(fixture['stats'], response.json['stats'])
self.assertEqual(fixture['status'], response.json['status']) 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): def test_get_service_status_invalid_id(self):
self.policy({'find_service_status': '@'}) self.policy({'find_service_status': '@'})

View File

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

View File

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

View File

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