def test_size_md5(self, dependency): timestamp = os.path.getmtime(dependency) size = os.path.getsize(dependency) md5 = md5sum(dependency) # incorrect size dont check md5 assert check_modified(dependency, (timestamp+1, size+1, '')) # correct size check md5 assert not check_modified(dependency, (timestamp+1, size, md5)) assert check_modified(dependency, (timestamp+1, size, ''))
def test_md5(): filePath = os.path.join(os.path.dirname(__file__),"sample_md5.txt") # result got using command line md5sum expected = "45d1503cb985898ab5bd8e58973007dd" assert expected == md5sum(filePath)