diff options
Diffstat (limited to 'src/pybind/mgr/dashboard/tests/test_access_control.py')
-rw-r--r-- | src/pybind/mgr/dashboard/tests/test_access_control.py | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/pybind/mgr/dashboard/tests/test_access_control.py b/src/pybind/mgr/dashboard/tests/test_access_control.py index 3592c741f0d..74414aa23e3 100644 --- a/src/pybind/mgr/dashboard/tests/test_access_control.py +++ b/src/pybind/mgr/dashboard/tests/test_access_control.py @@ -7,6 +7,7 @@ import json import time import unittest +from . import CmdException, exec_dashboard_cmd from .. import mgr from ..security import Scope, Permission from ..services.access_control import handle_access_control_command, \ @@ -15,12 +16,6 @@ from ..services.access_control import handle_access_control_command, \ SYSTEM_ROLES -class CmdException(Exception): - def __init__(self, retcode, message): - super(CmdException, self).__init__(message) - self.retcode = retcode - - class AccessControlTest(unittest.TestCase): CONFIG_KEY_DICT = {} @@ -45,15 +40,7 @@ class AccessControlTest(unittest.TestCase): @classmethod def exec_cmd(cls, cmd, **kwargs): - cmd_dict = {'prefix': 'dashboard {}'.format(cmd)} - cmd_dict.update(kwargs) - ret, out, err = handle_access_control_command(cmd_dict) - if ret < 0: - raise CmdException(ret, err) - try: - return json.loads(out) - except ValueError: - return out + return exec_dashboard_cmd(handle_access_control_command, cmd, **kwargs) def load_persistent_db(self): config_key = AccessControlDB.accessdb_config_key() |