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
1 change: 1 addition & 0 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ check-wheel-contents==0.6.1
coverage==7.8.0
pipdeptree==2.26.0
ruff==0.11.5
time-machine==2.19.0
twine==6.1.0
11 changes: 4 additions & 7 deletions tests/test_storage.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import datetime
import os
from unittest import mock
from urllib import parse

from django.core.files.storage import DefaultStorage
from django.test import TestCase, override_settings

import time_machine

from contentfiles.storage import MediaStorage, PrivateStorage, private_storage


Expand Down Expand Up @@ -70,12 +71,8 @@ def test_private_storage(self, mock_get_date):
CONTENTFILES_S3_REGION="eu-west-2",
CONTENTFILES_S3_ENDPOINT_URL="https://s3.dualstack.eu-west-2.amazonaws.com",
)
@mock.patch("botocore.auth.datetime")
def test_private_storage_aws4(self, mock_datetime):
mock_datetime.datetime.utcnow.return_value = datetime.datetime(
2020, 1, 1, 12, 34, 56, 0, tzinfo=datetime.timezone.utc
)

@time_machine.travel("20200101T123456Z")
def test_private_storage_aws4(self):
storage = PrivateStorage()
storage.access_key = "AKIA1234567890ABCDEF"
storage.secret_key = "1234567890123456789012345678901234567890" # noqa:S105
Expand Down