def test_delete(self): raw_res = {"device_owner": "abbabaab", "id": "some_id"} user = mock.MagicMock() resources.NeutronPort(resource=raw_res, user=user).delete() user.neutron().delete_port.assert_called_once_with(raw_res["id"])
def test_delete_port_raise_exception(self): raw_res = {"device_owner": "abbabaab", "id": "some_id"} user = mock.MagicMock() user.neutron().delete_port.side_effect = ( neutron_exceptions.PortNotFoundClient) resources.NeutronPort(resource=raw_res, user=user).delete() user.neutron().delete_port.assert_called_once_with(raw_res["id"])
def test_delete_port_device_owner(self): raw_res = { "device_owner": "network:router_interface", "id": "some_id", "device_id": "dev_id" } user = mock.MagicMock() resources.NeutronPort(resource=raw_res, user=user).delete() user.neutron().remove_interface_router.assert_called_once_with( raw_res["device_id"], {"port_id": raw_res["id"]})