def test_api_endpoints_behind_rbac_wall(self):
        #  alias_model = self.models['aliases']['alias1.yaml']
        sensor_model = self.models['sensors']['sensor1.yaml']
        rule_model = self.models['rules']['rule1.yaml']
        enforcement_model = self.models['enforcements']['enforcement1.yaml']
        execution_model = self.models['executions']['execution1.yaml']

        supported_endpoints = [
            # Packs
            {
                'path': '/v1/packs',
                'method': 'GET'
            },
            {
                'path': '/v1/packs/dummy_pack_1',
                'method': 'GET'
            },
            # Pack views
            {
                'path': '/v1/packs/views/files/dummy_pack_1',
                'method': 'GET'
            },
            {
                'path': '/v1/packs/views/file/dummy_pack_1/pack.yaml',
                'method': 'GET'
            },
            # Sensors
            {
                'path': '/v1/sensortypes',
                'method': 'GET'
            },
            {
                'path': '/v1/sensortypes/%s' % (sensor_model.ref),
                'method': 'GET'
            },
            {
                'path': '/v1/sensortypes/%s' % (sensor_model.ref),
                'method': 'PUT',
                'payload': {'enabled': False}
            },
            # Actions
            {
                'path': '/v1/actions',
                'method': 'GET'
            },
            {
                'path': '/v1/actions/wolfpack.action-1',
                'method': 'GET'
            },
            {
                'path': '/v1/actions',
                'method': 'POST',
                'payload': MOCK_ACTION_1
            },
            {
                'path': '/v1/actions/wolfpack.action-1',
                'method': 'PUT',
                'payload': MOCK_ACTION_1
            },
            {
                'path': '/v1/actions/wolfpack.action-1',
                'method': 'DELETE'
            },
            # Action aliases
            {
                'path': '/v1/actionalias',
                'method': 'GET'
            },
            {
                'path': '/v1/actionalias/aliases.alias1',
                'method': 'GET'
            },
            {
                'path': '/v1/actionalias',
                'method': 'POST',
                'payload': MOCK_ACTION_ALIAS_1
            },
            {
                'path': '/v1/actionalias/aliases.alias1',
                'method': 'PUT',
                'payload': MOCK_ACTION_ALIAS_1
            },
            {
                'path': '/v1/actionalias/aliases.alias1',
                'method': 'DELETE'
            },
            # Rules
            {
                'path': '/v1/rules',
                'method': 'GET'
            },
            {
                'path': '/v1/rules/%s' % (rule_model.ref),
                'method': 'GET'
            },
            {
                'path': '/v1/rules',
                'method': 'POST',
                'payload': MOCK_RULE_1
            },
            {
                'path': '/v1/rules/%s' % (rule_model.ref),
                'method': 'PUT',
                'payload': {'enabled': False}
            },
            {
                'path': '/v1/rules/%s' % (rule_model.ref),
                'method': 'DELETE'
            },
            # Rule enforcements
            {
                'path': '/v1/ruleenforcements',
                'method': 'GET'
            },
            {
                'path': '/v1/ruleenforcements/%s' % (enforcement_model.id),
                'method': 'GET'
            },
            # Action Executions
            {
                'path': '/v1/executions',
                'method': 'GET'
            },
            {
                'path': '/v1/executions/%s' % (execution_model.id),
                'method': 'GET'
            },
            {
                'path': '/v1/executions',
                'method': 'POST',
                'payload': {'action': 'core.local'}  # schedule execution / run action
            },
            {
                'path': '/v1/executions/%s' % (execution_model.id),
                'method': 'DELETE'  # stop execution
            },
            {
                'path': (execution_model.id) % '/v1/executions/%s/re_run',
                'method': 'POST',  # re-run execution
                'payload': {'parameters': {}}
            },
            # Action execution nested controllers
            {
                'path': '/v1/executions/%s/attribute/trigger_instance' % (execution_model.id),
                'method': 'GET'
            },
            {
                'path': '/v1/executions/%s/children' % (execution_model.id),
                'method': 'GET'
            },
            # Alias executions
            {
                'path': '/v1/aliasexecution',
                'method': 'POST',
                'payload': {'name': 'alias1', 'format': 'foo bar ponies',
                            'command': 'foo bar ponies',
                            'user': 'channel', 'source_channel': 'bar'}
            }
        ]

        self.use_user(self.users['no_permissions'])
        for endpoint in supported_endpoints:
            response = self._perform_request_for_endpoint(endpoint=endpoint)
            msg = '%s "%s" didn\'t return 403 status code (body=%s)' % (endpoint['method'],
                                                                        endpoint['path'],
                                                                        response.body)
            self.assertEqual(response.status_code, httplib.FORBIDDEN, msg)
dataset/ETHPy150Open StackStorm/st2/st2api/tests/unit/controllers/v1/test_rbac_for_supported_endpoints.py/APIControllersRBACTestCase.test_api_endpoints_behind_rbac_wall/swapped operands of `%`