Example #1
0
def test_action_obj_was_specified_not_present(fx_get_sub_parser, fx_cmd_line_args_clone_prefix):
    """
    Test to verify that if an action object is not specified in the args
    that action_obj_was_specified() returns False as expected
    """
    cmd_clone = CmdClone(fx_get_sub_parser)

    args = cmd_clone.parser.parse_known_args()[0]

    for functions in TEST_EXPORT.get('functions'):

        if functions['name'] not in args.function:
            assert not CmdClone.action_obj_was_specified(args, functions)
Example #2
0
def test_action_obj_was_specified_success(fx_get_sub_parser, fx_cmd_line_args_clone_prefix):
    """
    Test to verify that if an action object is specified in the args
    that action_obj_was_specified() returns True as expected
    """
    cmd_clone = CmdClone(fx_get_sub_parser)

    args = cmd_clone.parser.parse_known_args()[0]
    function = TEST_EXPORT.get('functions')[0]

    for fn in TEST_EXPORT.get('functions'):
        if fn.get("name") == 'mock_function_one':
            function = fn
            break

    assert function['name'] == 'mock_function_one'
    assert CmdClone.action_obj_was_specified(args, function)