From a3605544f6953c324825aa9629ded9cecb7a91b7 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 5 Jan 2020 23:51:59 +0100 Subject: [PATCH] Added some pytest Signed-off-by: Dimitris Zlatanidis --- slpkg/md5sum.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/slpkg/md5sum.py b/slpkg/md5sum.py index 3d2c71ab..f8d3bf48 100644 --- a/slpkg/md5sum.py +++ b/slpkg/md5sum.py @@ -33,3 +33,11 @@ def md5(source): with open(source, "rb") as file_to_check: data = file_to_check.read() return hashlib.md5(data).hexdigest() + + +def test_md5(source="superuser.py"): + """Testing hashing with pytest""" + source = source.replace("%2B", "+") + with open(source, "rb") as file_to_check: + data = file_to_check.read() + assert hashlib.md5(data).hexdigest() == "e6cebdf37fbc1b8e9d3c5e3e53b300c1"