Пример #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_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'
Пример #3
0
def test_added_new_context_path():
    validator = ScriptValidator("temp_file", check_git=False)
    validator.change_string = "+   - contextPath: sadf"

    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"
Пример #4
0
def test_not_changed_context_path():
    validator = ScriptValidator("temp_file", check_git=False)
    validator.change_string = "not changed context path"

    assert validator.is_context_path_changed() is False, "The script validator couldn't find the context " \
        "path as not touched"
Пример #5
0
def test_moved_context_path():
    validator = ScriptValidator("temp_file", check_git=False)
    validator.change_string = "-   - contextPath: sadf\n+   - contextPath: sadf"

    assert validator.is_context_path_changed() is False, "The script validator couldn't find the context " \
        "path as the same"
Пример #6
0
def test_changed_context_path():
    validator = ScriptValidator("temp_file", check_git=False)
    validator.change_string = "-   - contextPath: sadf\n+   - contextPath: abc"

    assert validator.is_context_path_changed(), "The script validator couldn't find the context path as updated"