def test_normal_file(self): args = __refargs__ hashlib_result = hashlib.sha256(self.fname.encode("utf-8")).hexdigest() copy2hash_result = copy2hash.HashTag(args=args).generate_hashname( fname=self.fname, suffix=".txt", sha_key="sha256") assert copy2hash_result == f"{hashlib_result}.txt"
def test_new_ending_file(self): args = __refargs__ args["file_extension"] = True hashlib_result = hashlib.sha256(self.fname.encode("utf-8")).hexdigest() copy2hash_result = copy2hash.HashTag(args=args).generate_hashname( fname=self.fname, suffix=".txt", sha_key="sha256") assert copy2hash_result == f"{hashlib_result}.sha256"
def test_shake_256(self): hashlib_result = hashlib.shake_256( self.fpath.encode("utf-8")).hexdigest(32) copy2hash_result = copy2hash.HashTag(args={}).fpath2hash( self.fpath, sha_key="shake_256") assert hashlib_result == copy2hash_result
def test_md5(self): hashlib_result = hashlib.md5(self.fpath.encode("utf-8")).hexdigest() copy2hash_result = copy2hash.HashTag(args={}).fpath2hash(self.fpath, sha_key="md5") assert hashlib_result == copy2hash_result