コード例 #1
0
def test_moved_context_path():
    validator = ScriptValidator('temp_file', check_git=False)
    validator.old_script = {
        'outputs': [
            {
                'contextPath': 'test1'
            },
            {
                'contextPath': 'test2'
            }
        ]
    }
    validator.current_script = {
        'outputs': [
            {
                'contextPath': 'test2'
            },
            {
                'contextPath': 'test1'
            }
        ]
    }

    assert validator.is_context_path_changed() is False, "The script validator couldn't find the context " \
        'path as the same'
コード例 #2
0
def test_untouched_arg_list_in_script():
    validator = ScriptValidator('temp_file', check_git=False)
    validator.old_script = {
        'args': [
            {
                'name': 'test1'
            },
            {
                'name': 'test2'
            }
        ]
    }
    validator.current_script = {
        'args': [
            {
                'name': 'test1'
            },
            {
                'name': 'test2'
            }
        ]
    }

    assert validator.is_arg_changed() is False, 'The script validator found the arg list has breaking backward ' \
        'compatibility although it was not touched'
コード例 #3
0
def test_changed_arg_in_script():
    validator = ScriptValidator('temp_file', check_git=False)
    validator.old_script = {
        'args': [
            {
                'name': 'test1'
            },
            {
                'name': 'test2'
            }
        ]
    }
    validator.current_script = {
        'args': [
            {
                'name': 'test2'
            },
            {
                'name': 'test1'
            },
            {
                'name': 'test3'
            }
        ]
    }

    assert validator.is_arg_changed() is False, "The script validator didn't found the arg list has breaking " \
        'backward compatibility although an arg was renamed'
コード例 #4
0
def test_added_docker_image_on_existing_script():
    validator = ScriptValidator('temp_file', check_git=False)
    validator.old_script = {}
    validator.current_script = {'dockerimage': 'test_updated'}

    assert validator.is_docker_image_changed(
    ), "The script validator couldn't find the docker image as changed"
コード例 #5
0
def test_invalid_subtype_python2():
    validator = ScriptValidator("temp_file", check_git=False)
    validator.current_script = {"type": "python", "subtype": "python2"}
    validator.old_script = {"type": "python", "subtype": "python2"}

    assert validator.is_invalid_subtype() is False, \
        "found invalid subtype while it is valid - python2"
コード例 #6
0
def test_invalid_subtype_blabla():
    validator = ScriptValidator("temp_file", check_git=False)
    validator.current_script = {"type": "python", "subtype": "blabla"}
    validator.old_script = {"type": "python", "subtype": "blabla"}

    assert validator.is_invalid_subtype() is True, \
        "found valid subtype while it is invalid - blabla"
コード例 #7
0
def test_changed_required_field_to_not_required_in_integration():
    validator = ScriptValidator('temp_file', check_git=False)
    validator.old_script = {'args': [{'name': 'test', 'required': True}]}
    validator.current_script = {'args': [{'name': 'test', 'required': False}]}

    assert validator.is_added_required_args() is False, 'The script validator found the change to not required ' \
        'as a one who breaks backward compatability'
コード例 #8
0
def test_not_changed_required_field_scenario2_in_integration():
    validator = ScriptValidator('temp_file', check_git=False)
    validator.old_script = {'args': [{'name': 'test', 'required': False}]}
    validator.current_script = {'args': [{'name': 'test', 'required': False}]}

    assert validator.is_added_required_args() is False, 'The script validator found a backward compatibility ' \
        'change although no such change was done'
コード例 #9
0
def test_deleted_arg_from_script():
    validator = ScriptValidator('temp_file', check_git=False)
    validator.old_script = {'args': [{'name': 'test1'}, {'name': 'test2'}]}
    validator.current_script = {'args': [{'name': 'test1'}]}

    assert validator.is_arg_changed(
    ), "The script validator couldn't find deleted arg name"
コード例 #10
0
def test_added_required_field_in_integration():
    validator = ScriptValidator('temp_file', check_git=False)
    validator.old_script = {'args': [{'name': 'test', 'required': False}]}
    validator.current_script = {'args': [{'name': 'test', 'required': True}]}

    assert validator.is_added_required_args(
    ), "The script validator couldn't find the new required args"
コード例 #11
0
ファイル: script_test.py プロジェクト: wwylie89/testDemisto
def test_updated_docker_image_on_sane_doc_reports_fail_name():
    validator = ScriptValidator('SaneDocReport.yml', check_git=False)
    validator.old_script = {'dockerimage': '1.0.0'}
    validator.current_script = {'dockerimage': '1.0.1'}

    assert not validator.is_backward_compatible(
    ), "The script validator passed sane-doc-reports eventough it shouldn't"
コード例 #12
0
ファイル: script_test.py プロジェクト: wwylie89/testDemisto
def test_is_changed_subtype_python3():
    validator = ScriptValidator("temp_file", check_git=False)
    validator.current_script = {"type": "python", "subtype": "python3"}
    validator.old_script = {"type": "python", "subtype": "python3"}

    assert validator.is_changed_subtype() is False, \
        "found changed subtype while it was not changed"
コード例 #13
0
ファイル: script_test.py プロジェクト: wwylie89/testDemisto
def test_is_changed_subtype_python2_to_3():
    validator = ScriptValidator("temp_file", check_git=False)
    validator.current_script = {"type": "python", "subtype": "python3"}
    validator.old_script = {"type": "python", "subtype": "python2"}

    assert validator.is_changed_subtype() is True, \
        "Did not find changed subtype while it was changed"
コード例 #14
0
ファイル: script_test.py プロジェクト: wwylie89/testDemisto
def test_updated_docker_image_on_sane_doc_reports():
    validator = ScriptValidator('Scripts/SaneDocReport/SaneDocReport.yml',
                                check_git=False)
    validator.old_script = {'dockerimage': '1.0.0'}
    validator.current_script = {'dockerimage': '1.0.1'}

    assert validator.is_backward_compatible(
    ), "The script validator didn't pass sane-doc-reports"
コード例 #15
0
ファイル: script_test.py プロジェクト: wwylie89/testDemisto
def test_updated_docker_image_on_sane_doc_reports_fail_subtype():
    validator = ScriptValidator('Scripts/SaneDocReport/SaneDocReport.yml',
                                check_git=False)
    validator.current_script = {"type": "python", "subtype": "python3"}
    validator.old_script = {"type": "python", "subtype": "python2"}

    assert validator.is_changed_subtype() is True, \
        "Did not find changed subtype while it was changed"
    assert validator.is_backward_compatible(
    ) is False, "The script validator passed sane-doc-reports"
コード例 #16
0
def test_added_new_context_path():
    validator = ScriptValidator('temp_file', check_git=False)
    validator.old_script = {'outputs': [{'contextPath': 'test1'}]}
    validator.current_script = {
        'outputs': [{
            'contextPath': 'test1'
        }, {
            'contextPath': 'test2'
        }]
    }

    assert validator.is_context_path_changed() is False, 'The script validator found an existing context path as ' \
        'changed although it is not, but new context path added to a command'