def test_tempering_detected(): txt = """ print 'toto' print 'rev' """ hm = {} write_file(ex_file, txt, hm) assert not user_modified(ex_file, hm) txt = txt[:3] + '#' + txt[4:] with open(ex_file, 'w') as f: f.write(txt) assert user_modified(ex_file, hm)
def test_newly_created_file_not_user_modified(): content = "lorem ipsum\n" * 10 hm = {} write_file(ex_file, content, hm) assert not user_modified(ex_file, hm)
def test_non_registered_file_not_user_modified(): with open(ex_file, 'w') as f: f.write("lorem ipsum\n") assert not user_modified(ex_file, {})