def test_create_action_with_invalid_orchestrator(): params = dict(description='description goes here.', hosts=['host01'], orchestrator='abc') with pytest.raises(TefloActionError) as ex: Action(name='action', parameters=params) assert 'Orchestrator: abc is not supported!' in ex.value.args
def test_create_action_with_name_in_parameters(): params = dict(name='action', description='description goes here.', hosts=['host01']) action = Action(parameters=params) assert action.name == 'action'
def test_timeout_from_cfg(config): params = dict( description='description goes here.', hosts=['host01'] ) action = Action(name='action', parameters=params, config=config) assert action._orchestrate_timeout is 25
def test_create_action_with_name(): params = dict( description='description goes here.', hosts=['host01'] ) action = Action(name='action', parameters=params) assert isinstance(action, Action)
def test_create_action_without_hosts(): params = dict(name='action', description='description goes here.', hosts=None) with pytest.raises(TefloActionError) as ex: Action(parameters=params) assert 'Unable to associate hosts to action: action.No hosts ' \ 'defined!' in ex.value.args
def test_create_action_with_hosts_as_str(): params = dict( description='description goes here.', hosts='host01, host02', key='value' ) action = Action(name='action', parameters=params) assert isinstance(action.hosts, list)
def test_create_action_without_name(): params = dict( description='description goes here.', hosts=['host01'] ) with pytest.raises(TefloActionError): Action(parameters=params)
def action_resource(config): return Action( name='action', config=config, parameters=dict( description='description', hosts=['host01'], orchestrator='ansible' ) )
def action2(config): return Action( name='action', config=config, parameters=dict( description='description', hosts=['host_3'], orchestrator='ansible', labels='label3' ) )
def test_timeout_from_scenario(timeout_param_orchestrate): action = Action(name='action', parameters=timeout_param_orchestrate) assert action._orchestrate_timeout is 20