diff options
author | Slawek Kaplonski <skaplons@redhat.com> | 2023-04-07 10:10:39 +0200 |
---|---|---|
committer | Slawek Kaplonski <skaplons@redhat.com> | 2023-04-21 16:22:42 +0200 |
commit | 670cc383e0345063c0bf9022f8829d5817457e00 (patch) | |
tree | f012101732ea0df493946b0ab93de10f4ab828d3 /neutron/tests/unit/extensions/test_local_ip.py | |
parent | 05ba4257dec5e80565aedb49685d8784424be461 (diff) | |
download | neutron-670cc383e0345063c0bf9022f8829d5817457e00.tar.gz |
[S-RBAC] Switch to new policies by default
As part of the Secure RBAC community goal, we should switch options
"enforce_new_defaults" and "enforce_scope" to be True by default.
It will be still possible to fallback to old policy rules by configuring
those config options to False in Neutron config.
Change-Id: I09c0026ccf87e6c0bb1fa59165c03dc508fba6fa
Diffstat (limited to 'neutron/tests/unit/extensions/test_local_ip.py')
-rw-r--r-- | neutron/tests/unit/extensions/test_local_ip.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/neutron/tests/unit/extensions/test_local_ip.py b/neutron/tests/unit/extensions/test_local_ip.py index 5de762d8b1..e15b31e821 100644 --- a/neutron/tests/unit/extensions/test_local_ip.py +++ b/neutron/tests/unit/extensions/test_local_ip.py @@ -19,7 +19,6 @@ from unittest import mock import netaddr from neutron_lib.api.definitions import local_ip as apidef from neutron_lib import constants -from neutron_lib import context import webob.exc from neutron.extensions import local_ip as lip_ext @@ -46,10 +45,8 @@ class LocalIPTestBase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): for k, v in kwargs.items(): local_ip['local_ip'][k] = v - req = self.new_create_request('local-ips', local_ip) - neutron_context = context.Context( - '', kwargs.get('project_id', self._tenant_id), is_admin=True) - req.environ['neutron.context'] = neutron_context + req = self.new_create_request('local-ips', local_ip, + tenant_id=self._tenant_id, as_admin=True) res = req.get_response(self.ext_api) if res.status_int >= webob.exc.HTTPClientError.code: raise webob.exc.HTTPClientError(code=res.status_int) @@ -57,9 +54,7 @@ class LocalIPTestBase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): def _update_local_ip(self, lip_id, data): update_req = self.new_update_request( - 'local-ips', data, lip_id) - update_req.environ['neutron.context'] = context.Context( - '', self._tenant_id) + 'local-ips', data, lip_id, tenant_id=self._tenant_id) res = update_req.get_response(self.ext_api) if res.status_int >= webob.exc.HTTPClientError.code: raise webob.exc.HTTPClientError(code=res.status_int) @@ -73,9 +68,8 @@ class LocalIPTestBase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): req = self.new_create_request('local_ips', data=local_ip_assoc, id=local_ip_id, - subresource='port_associations') - neutron_context = context.Context('', self._tenant_id) - req.environ['neutron.context'] = neutron_context + subresource='port_associations', + tenant_id=self._tenant_id) res = req.get_response(self.ext_api) if res.status_int >= webob.exc.HTTPClientError.code: raise webob.exc.HTTPClientError(code=res.status_int) |