Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 6 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,11 @@ class CorruptingAuthorizedSession(tr_requests.AuthorizedSession):
constructor.
"""

EMPTY_MD5 = base64.b64encode(hashlib.md5(b"").digest()).decode("utf-8")
EMPTY_MD5 = base64.b64encode(
hashlib.md5(
b"", **({"usedforsecurity": False} if sys.version_info >= (3, 9) else {})
).digest()
).decode("utf-8")
crc32c = google_crc32c.Checksum()
crc32c.update(b"")
EMPTY_CRC32C = base64.b64encode(crc32c.digest()).decode("utf-8")
Expand Down
5 changes: 4 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,9 @@ def img_stream():


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


Expand Down