Exemple #1
0
def test_modified_file_detect_modifications_in_preserved_sections(tmp_pth):
    txt = "lorem ipsum\n" * 10
    hv = compute_hash(txt)

    with open(tmp_pth, 'w') as f:
        f.write("{# pkglts, toto\n")
        f.write(txt)
        f.write("\n#}\n")

    assert not modified_file_hash(tmp_pth, {tmp_pth: dict(toto=hv)})

    with open(tmp_pth, 'w') as f:
        f.write("{# pkglts, toto\n")
        f.write(txt * 2)
        f.write("\n#}\n")

    assert modified_file_hash(tmp_pth, {tmp_pth: dict(toto=hv)})
def test_modified_file_detect_modifications_in_preserved_sections():
    txt = "lorem ipsum\n" * 10
    hv = compute_hash(txt)

    with open(ex_file, 'w') as f:
        f.write("{# pkglts, toto\n")
        f.write(txt)
        f.write("\n#}\n")

    assert not modified_file_hash(ex_file, {ex_file: dict(toto=hv)})

    with open(ex_file, 'w') as f:
        f.write("{# pkglts, toto\n")
        f.write(txt * 2)
        f.write("\n#}\n")

    assert modified_file_hash(ex_file, {ex_file: dict(toto=hv)})
Exemple #3
0
def test_compute_hash():
    assert compute_hash("toto") == compute_hash("toto")
    assert compute_hash("toto") != compute_hash("titi")
def test_compute_hash():
    assert compute_hash("toto") == compute_hash("toto")
    assert compute_hash("toto") != compute_hash("titi")