Esempio n. 1
0
def test_generate_diff_json():
    file1, file2 = loader.load_file('before_flat.json', 'after_flat.json')
    val = formatter(generate_diff(file1, file2))
    g = open("tests/fixtures/test_flat.txt", "r")
    contentsg = g.read()
    assert val == contentsg
    file1, file2 = loader.load_file('before.json', 'after.json')
    val = formatter(generate_diff(file1, file2))
    g = open("tests/fixtures/test_tree.txt", "r")
    contentsg = g.read()
Esempio n. 2
0
def test_generate_diff(content_before, content_after, difference):
    assert generate_diff(content_before, content_after) == difference
Esempio n. 3
0
def test_rec_yaml():
    assert generate_diff(path7, path8) == string2
Esempio n. 4
0
def test_rec_json():
    assert generate_diff(path5, path6) == string2
Esempio n. 5
0
def test_flat_yaml():
    assert generate_diff(path3, path4) == string
Esempio n. 6
0
def test_flat_json():
    assert generate_diff(path1, path2) == string
def test_generate_diff_json_formater(file1, file2, formater, diff):
    with open(diff) as f:
        json_diff = json.load(f)
    expected = sort_children(json_diff)
    expected = convert_to_dict(json_diff)
    assert convert_to_dict(sort_children(json.loads(generate_diff(file1, file2, formater)))) == expected
def test_generate_diff_with_formater(file1, file2, formater, diff):
    with open(diff) as f:
        expected = f.read().strip()
    assert generate_diff(file1, file2, formater) == expected
def test_generate_diff_flat_new(file1, file2, diff):
    with open(diff) as f:
        expected = f.read().strip()
    assert generate_diff(file1, file2) == expected