|
19 | 19 | from django.test import TestCase |
20 | 20 | from django.test import override_settings |
21 | 21 | from django.utils.timezone import is_aware |
22 | | -from moto import mock_s3 |
| 22 | +from moto import mock_aws |
23 | 23 |
|
24 | 24 | from storages.backends import s3 |
25 | 25 | from tests.utils import NonSeekableContentFile |
@@ -693,6 +693,14 @@ def test_url_unsigned(self): |
693 | 693 | self.storage.url("test_name") |
694 | 694 | self.storage.unsigned_connection.meta.client.generate_presigned_url.assert_called_once() |
695 | 695 |
|
| 696 | + def test_url_protocol(self): |
| 697 | + self.assertFalse(hasattr(settings, "AWS_S3_URL_PROTOCOL")) |
| 698 | + self.assertEqual(self.storage.url_protocol, "https:") |
| 699 | + |
| 700 | + with override_settings(AWS_S3_URL_PROTOCOL=None): |
| 701 | + storage = s3.S3Storage() |
| 702 | + self.assertEqual(storage.url_protocol, "https:") |
| 703 | + |
696 | 704 | @mock.patch("storages.backends.s3.datetime") |
697 | 705 | def test_storage_url_custom_domain_signed_urls(self, dt): |
698 | 706 | key_id = "test-key" |
@@ -999,8 +1007,6 @@ def test_save(self): |
999 | 1007 |
|
1000 | 1008 |
|
1001 | 1009 | class S3FileTests(TestCase): |
1002 | | - # Remove the override_settings after Python3.7 is dropped |
1003 | | - @override_settings(AWS_S3_OBJECT_PARAMETERS={"ContentType": "text/html"}) |
1004 | 1010 | def setUp(self) -> None: |
1005 | 1011 | self.storage = s3.S3Storage() |
1006 | 1012 | self.storage._create_connection = mock.MagicMock() |
@@ -1052,10 +1058,10 @@ def test_reopening(self): |
1052 | 1058 | self.assertIsNone(f._multipart) |
1053 | 1059 |
|
1054 | 1060 |
|
1055 | | -@mock_s3 |
| 1061 | +@mock_aws |
1056 | 1062 | class S3StorageTestsWithMoto(TestCase): |
1057 | 1063 | """ |
1058 | | - Using mock_s3 as a class decorator automatically decorates methods, |
| 1064 | + Using mock_aws as a class decorator automatically decorates methods, |
1059 | 1065 | but NOT classmethods or staticmethods. |
1060 | 1066 | """ |
1061 | 1067 |
|
|
0 commit comments