def test_delete_port_redis_is_dead(self, sg_cli):
device_id = str(uuid.uuid4())
mac_address = netaddr.EUI("AA:BB:CC:DD:EE:FF").value
mock_client = mock.MagicMock()
sg_cli.return_value = mock_client
mock_client.delete_vif.side_effect = Exception
try:
self.driver.delete_port(context=self.context, port_id=2,
mac_address=mac_address,
device_id=device_id)
mock_client.delete_vif.assert_called_once_with(
device_id, mac_address)
except Exception:
# This test fails without the exception handling in
# _delete_port_security_groups
self.fail("This shouldn't have raised")
评论列表
文章目录