Merge "Enforce autospec in test_notification_utils module"

This commit is contained in:
Zuul 2021-02-27 18:48:43 +00:00 committed by Gerrit Code Review
commit af8c8e14dc
2 changed files with 4 additions and 5 deletions

View File

@ -163,7 +163,8 @@ class APINotifyTestCase(tests_base.TestCase):
self.assertEqual(portgroup.standalone_ports_supported,
payload.standalone_ports_supported)
@mock.patch('ironic.objects.node.NodeMaintenanceNotification')
@mock.patch('ironic.objects.node.NodeMaintenanceNotification',
autospec=True)
def test_node_maintenance_notification(self, maintenance_mock):
maintenance_mock.__name__ = 'NodeMaintenanceNotification'
node = obj_utils.get_test_node(self.context,
@ -182,7 +183,7 @@ class APINotifyTestCase(tests_base.TestCase):
self.assertEqual(True, payload.maintenance)
self.assertEqual('test reason', payload.maintenance_reason)
@mock.patch.object(notification.NotificationBase, 'emit')
@mock.patch.object(notification.NotificationBase, 'emit', autospec=True)
def test_emit_maintenance_notification(self, emit_mock):
node = obj_utils.get_test_node(self.context)
test_level = fields.NotificationLevel.INFO
@ -190,4 +191,4 @@ class APINotifyTestCase(tests_base.TestCase):
notif_utils._emit_api_notification(self.context, node,
'maintenance_set',
test_level, test_status)
emit_mock.assert_called_once_with(self.context)
emit_mock.assert_called_once_with(mock.ANY, self.context)

View File

@ -144,8 +144,6 @@ per-file-ignores =
ironic/tests/unit/api/controllers/v1/test_volume_connector.py:H210
ironic/tests/unit/api/controllers/v1/test_driver.py:H210
ironic/tests/unit/api/controllers/v1/test_portgroup.py:H210
ironic/tests/unit/api/controllers/v1/test_types.py:H210
ironic/tests/unit/api/controllers/v1/test_notification_utils.py:H210
ironic/tests/unit/api/controllers/v1/test_port.py:H210
ironic/tests/unit/drivers/modules/test_console_utils.py:H210