

def test_get_params_types(self):
    runner = RunnerType()
    runner_params = {
        'foo': {
            'immutable': True,
            'required': True,
        },
        'bar': {
            'description': 'Some param.',
            'type': 'string',
        },
    }
    runner.runner_parameters = runner_params
    orig_runner_params = copy.deepcopy(runner.runner_parameters)
    action = Action()
    action.parameters = {
        'foo': {
            'immutable': False,
        },
        'stuff': {
            'description': 'Some param.',
            'type': 'string',
            'required': True,
        },
    }
    orig_action_params = copy.deepcopy(action.parameters)
    (params, rqd, opt, imm) = ActionRunCommand._get_params_types(runner, action)
    self.assertEqual(len(params.keys()), 3)
    self.assertTrue(('foo' in imm), '"foo" param should be in immutable set.')
    self.assertTrue(('foo' not in rqd), '"foo" param should not be in required set.')
    self.assertTrue(('foo' not in opt), '"foo" param should not be in optional set.')
    self.assertTrue(('bar' in opt), '"bar" param should be in optional set.')
    self.assertTrue(('bar' not in rqd), '"bar" param should not be in required set.')
    self.assertTrue(('bar' not in imm), '"bar" param should not be in immutable set.')
    self.assertTrue(('stuff' in rqd), '"stuff" param should be in required set.')
    self.assertTrue(('stuff' not in opt), '"stuff" param should be in optional set.')
    self.assertTrue(('stuff' not in imm), '"stuff" param should be in immutable set.')
    self.assertEqual(runner.runner_parameters, orig_runner_params, 'Runner params modified.')
    self.assertEqual(action.parameters, orig_action_params, 'Action params modified.')

dataset/ETHPy150Open StackStorm/st2/st2client/tests/unit/test_command_actionrun.py ActionRunCommandTest.test_get_params_types/original