def test_all_in_dir(dir_with_files): dfh = DirFileHash(dir_with_files) for one_filename in os.listdir(dir_with_files): m = md5() content = getattr(string, one_filename).encode() m.update(content) assert dfh[one_filename] == m.hexdigest()
def test_bad_dirname(): bad_dirname = '/garbage/dirname' dfh = DirFileHash(bad_dirname) assert dfh['abc.txt'] is None assert dfh[''] is None
def test_hasattr_dirname(): bad_name = '/garbage/name' dfh = DirFileHash(bad_name) assert dfh.dirname == bad_name