Skip to content

Commit e31d369

Browse files
committed
upgraded boto and moto
1 parent 3464f4b commit e31d369

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

core/services/storages/cloud/tests.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
from django.utils import timezone
1414
from minio.deleteobjects import DeleteError
1515
from mock.mock import call
16-
from moto import mock_s3
16+
from moto import mock_aws
1717

1818
from core.services.storages.cloud.aws import S3
1919
from core.services.storages.cloud.azure import BlobStorage
2020
from core.services.storages.cloud.minio import MinIO
2121

2222

2323
class S3Test(TestCase):
24-
@mock_s3
24+
@mock_aws
2525
def test_upload(self):
2626
_conn = boto3.resource('s3', region_name='us-east-1')
2727
_conn.create_bucket(Bucket='oclapi2-dev')
@@ -36,7 +36,7 @@ def test_upload(self):
3636
'content'
3737
)
3838

39-
@mock_s3
39+
@mock_aws
4040
def test_exists(self):
4141
_conn = boto3.resource('s3', region_name='us-east-1')
4242
_conn.create_bucket(Bucket='oclapi2-dev')
@@ -63,8 +63,8 @@ def test_upload_public(self):
6363
)
6464

6565
def test_upload_file(self):
66-
with patch("builtins.open", mock_open(read_data="file-content")) as mock_file:
67-
s3 = S3()
66+
s3 = S3()
67+
with patch("core.services.storages.cloud.aws.open", mock_open(read_data="file-content")) as mock_file:
6868
s3.upload = Mock(return_value=200) # pylint: disable=protected-access
6969
file_path = "path/to/file.ext"
7070
res = s3.upload_file(key=file_path, headers={'header1': 'val1'})
@@ -147,7 +147,7 @@ def test_upload_base64_no_ext(self):
147147
isinstance(mock_calls[0][1][1], ContentFile)
148148
)
149149

150-
@mock_s3
150+
@mock_aws
151151
def test_remove(self):
152152
conn = boto3.resource('s3', region_name='us-east-1')
153153
conn.create_bucket(Bucket='oclapi2-dev')
@@ -168,7 +168,7 @@ def test_remove(self):
168168
with self.assertRaises(ClientError):
169169
conn.Object('oclapi2-dev', 'some/path').get()
170170

171-
@mock_s3
171+
@mock_aws
172172
def test_url_for(self):
173173
_conn = boto3.resource('s3', region_name='us-east-1')
174174
_conn.create_bucket(Bucket='oclapi2-dev')

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ pydash==7.0.6
88
django-cors-headers==4.9.0
99
pyyaml==6.0.1
1010
colour_runner==0.1.1
11-
boto3==1.24.28
12-
moto==3.1.13
11+
boto3==1.36.10
12+
moto==5.0.27
1313
python-dateutil==2.8.2
1414
requests==2.32.3
1515
factory_boy==3.3.0

0 commit comments

Comments
 (0)