summaryrefslogtreecommitdiff
path: root/ironic/tests
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-02-23 15:11:24 +0000
committerGerrit Code Review <review@openstack.org>2021-02-23 15:11:24 +0000
commit5a66dafbf17e8b19e827454080705608b996e9c3 (patch)
tree1156479922578fb2c72142096470eb6121814c60 /ironic/tests
parent34d9805b9f141e22604434f1f85933fd40454679 (diff)
parent69b28ca99cd031c87936a414691f34eabbc74f3d (diff)
downloadironic-5a66dafbf17e8b19e827454080705608b996e9c3.tar.gz
Merge "Implement system scoped RBAC for utility APIs"
Diffstat (limited to 'ironic/tests')
-rw-r--r--ironic/tests/unit/api/controllers/v1/test_ramdisk.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/ironic/tests/unit/api/controllers/v1/test_ramdisk.py b/ironic/tests/unit/api/controllers/v1/test_ramdisk.py
index 063965754..51005b772 100644
--- a/ironic/tests/unit/api/controllers/v1/test_ramdisk.py
+++ b/ironic/tests/unit/api/controllers/v1/test_ramdisk.py
@@ -19,6 +19,7 @@ from http import client as http_client
from unittest import mock
import fixtures
+from keystonemiddleware import auth_token
from oslo_config import cfg
from oslo_utils import uuidutils
@@ -338,3 +339,31 @@ class TestHeartbeat(test_api_base.BaseApiTest):
headers={api_base.Version.string: '1.67'},
expect_errors=True)
self.assertEqual(http_client.BAD_REQUEST, response.status_int)
+
+
+@mock.patch.object(auth_token.AuthProtocol, 'process_request',
+ lambda *_: None)
+class TestLookupScopedRBAC(TestLookup):
+
+ """Test class to execute the Lookup tests with RBAC enforcement."""
+ def setUp(self):
+ super(TestLookupScopedRBAC, self).setUp()
+
+ cfg.CONF.set_override('enforce_scope', True, group='oslo_policy')
+ cfg.CONF.set_override('enforce_new_defaults', True,
+ group='oslo_policy')
+ cfg.CONF.set_override('auth_strategy', 'keystone')
+
+
+@mock.patch.object(auth_token.AuthProtocol, 'process_request',
+ lambda *_: None)
+class TestHeartbeatScopedRBAC(TestHeartbeat):
+
+ """Test class to execute the Heartbeat tests with RBAC enforcement."""
+ def setUp(self):
+ super(TestHeartbeatScopedRBAC, self).setUp()
+
+ cfg.CONF.set_override('enforce_scope', True, group='oslo_policy')
+ cfg.CONF.set_override('enforce_new_defaults', True,
+ group='oslo_policy')
+ cfg.CONF.set_override('auth_strategy', 'keystone')