Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/resumable_media/system/requests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import http.client
import io
import os
import sys

import google.auth # type: ignore
import google.auth.transport.requests as tr_requests # type: ignore
Expand Down Expand Up @@ -63,7 +64,10 @@ class CorruptingAuthorizedSession(tr_requests.AuthorizedSession):
constructor.
"""

EMPTY_MD5 = base64.b64encode(hashlib.md5(b"").digest()).decode("utf-8")
if sys.version_info >= (3, 9):
EMPTY_MD5 = base64.b64encode(hashlib.md5(b"", usedforsecurity=False).digest()).decode("utf-8")
else:
EMPTY_MD5 = base64.b64encode(hashlib.md5(b"").digest()).decode("utf-8")
crc32c = google_crc32c.Checksum()
crc32c.update(b"")
EMPTY_CRC32C = base64.b64encode(crc32c.digest()).decode("utf-8")
Expand Down
6 changes: 5 additions & 1 deletion tests/resumable_media/system/requests/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io
import os
import urllib.parse
import sys

import pytest # type: ignore
from unittest import mock
Expand Down Expand Up @@ -73,7 +74,10 @@ def img_stream():


def get_md5(data):
hash_obj = hashlib.md5(data)
if sys.version_info >= (3, 9):
hash_obj = hashlib.md5(data, usedforsecurity=False)
else:
hash_obj = hashlib.md5(data)
return base64.b64encode(hash_obj.digest())


Expand Down