from devicetest.core.test_case import TestCase, Step
from PermissionUtils import PermissionUtils
class testPermissionName(TestCase):
def __init__(self, controllers):
self.TAG = self.__class__.__name__
super().__init__(self.TAG, controllers)
def setup(self):
Step("Setup")
def process(self):
Step("Process")
permissionBundleInfo = self.device1.execute_shell_command("bm dump -n ohos.global.systemres")
permissionUtils = PermissionUtils()
devicePermissionList = permissionUtils.getDevicePermissionList(permissionBundleInfo)
errorList = []
for permission in devicePermissionList:
if permission.startswith('ohos') and permission not in permissionUtils.systemPermissionList and permission not in permissionUtils.userPermissionList:
errorList.append(permission)
if len(errorList) != 0:
self.log.info('These permissions can not start with \'ohos\'. errorList: [' + ', '.join(errorList) + ']')
assert False
def teardown(self):
Step("Teardown")