示例#1
0
    def test_mismatching_md5sums(self):
        download_obj = DownloadWorkflow(pipeline="dummy")
        test_hash = hashlib.md5()
        test_hash.update(b"other value")
        val_hash = test_hash.hexdigest()

        with open("/tmp/test", "w") as f:
            f.write("test")

        download_obj.validate_md5("/tmp/test", val_hash)
示例#2
0
    def test_matching_md5sums(self, tmpfile):
        download_obj = DownloadWorkflow(pipeline="dummy")
        test_hash = hashlib.md5()
        test_hash.update(b"test")
        val_hash = test_hash.hexdigest()

        with open(tmpfile.name, "w") as f:
            f.write("test")

        download_obj.validate_md5(tmpfile.name, val_hash)
示例#3
0
    def test_mismatching_md5sums(self):
        download_obj = DownloadWorkflow(pipeline="dummy")
        test_hash = hashlib.md5()
        test_hash.update(b"other value")
        val_hash = test_hash.hexdigest()
        tmpfilehandle, tmpfile = tempfile.mkstemp()

        with open(tmpfile, "w") as f:
            f.write("test")

        download_obj.validate_md5(tmpfile[1], val_hash)

        # Clean up
        os.remove(tmpfile)