Skip to content

Commit b2082cb

Browse files
committed
Remove unused boto3 imports and related patches in test files
1 parent 541c138 commit b2082cb

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

test/test_cloud_store_api/test_s3_uploader.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,12 @@ def test_invalid_directory(self):
6363
assert_raises(RuntimeError, validate_directory, 'hello$world')
6464

6565
@with_context
66-
@patch('pybossa.cloud_store_api.s3.boto.s3.key.Key.set_contents_from_file')
6766
def test_upload_from_string(self, set_contents):
6867
with patch.dict(self.flask_app.config, self.default_config):
6968
url = s3_upload_from_string('bucket', 'hello world', 'test.txt')
7069
assert url == 'https://s3.storage.com:443/bucket/test.txt', url
7170

7271
@with_context
73-
@patch('pybossa.cloud_store_api.s3.boto.s3.key.Key.set_contents_from_file')
7472
def test_upload_from_string_util(self, set_contents):
7573
with patch.dict(self.flask_app.config, self.util_config):
7674
"""Test -util keyword dropped from meta url returned from s3 upload."""
@@ -85,15 +83,13 @@ def test_upload_from_string_exception(self, open):
8583
'bucket', 'hellow world', 'test.txt')
8684

8785
@with_context
88-
@patch('pybossa.cloud_store_api.s3.boto.s3.key.Key.set_contents_from_file')
8986
def test_upload_from_string_return_key(self, set_contents):
9087
with patch.dict(self.flask_app.config, self.default_config):
9188
key = s3_upload_from_string('bucket', 'hello world', 'test.txt',
9289
return_key_only=True)
9390
assert key == 'test.txt', key
9491

9592
@with_context
96-
@patch('pybossa.cloud_store_api.s3.boto.s3.key.Key.set_contents_from_file')
9793
def test_upload_from_storage(self, set_contents):
9894
with patch.dict(self.flask_app.config, self.default_config):
9995
stream = BytesIO(b'Hello world!')
@@ -104,31 +100,26 @@ def test_upload_from_storage(self, set_contents):
104100
assert url == 'https://s3.storage.com:443/bucket/test.txt', url
105101

106102
@with_context
107-
@patch('pybossa.cloud_store_api.s3.boto.s3.key.Key.set_contents_from_file')
108-
@patch('pybossa.cloud_store_api.s3.boto.s3.key.Key.generate_url')
109103
def test_upload_remove_query_params(self, generate_url, set_content):
110104
with patch.dict(self.flask_app.config, self.default_config):
111105
generate_url.return_value = 'https://s3.storage.com/bucket/key?query_1=aaaa&query_2=bbbb'
112106
url = s3_upload_file('bucket', 'a_file', 'a_file', {}, 'dev')
113107
assert url == 'https://s3.storage.com/bucket/key'
114108

115109
@with_context
116-
@patch('pybossa.cloud_store_api.s3.boto.s3.bucket.Bucket.delete_key')
117110
def test_delete_file_from_s3(self, delete_key):
118111
with patch.dict(self.flask_app.config, self.default_config):
119112
delete_file_from_s3('test_bucket', '/the/key')
120113
delete_key.assert_called_with('/the/key', headers={}, version_id=None)
121114

122115
@with_context
123-
@patch('pybossa.cloud_store_api.s3.boto.s3.key.Key.get_contents_as_string')
124116
def test_get_file_from_s3(self, get_contents):
125117
get_contents.return_value = 'abcd'
126118
with patch.dict(self.flask_app.config, self.default_config):
127119
get_file_from_s3('test_bucket', '/the/key')
128120
get_contents.assert_called()
129121

130122
@with_context
131-
@patch('pybossa.cloud_store_api.s3.boto.s3.key.Key.get_contents_as_string')
132123
def test_decrypts_file_from_s3(self, get_contents):
133124
config = self.default_config.copy()
134125
config['FILE_ENCRYPTION_KEY'] = 'abcd'

test/test_web.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
from pybossa.util import get_user_signup_method, unicode_csv_reader
3838
from bs4 import BeautifulSoup
3939
from requests.exceptions import ConnectionError
40-
import boto3
4140
from pybossa.model.project import Project
4241
from pybossa.model.category import Category
4342
from pybossa.model.task import Task
@@ -8486,7 +8485,6 @@ def test_task_gold(self):
84868485
assert not t.expiration
84878486

84888487
@with_context
8489-
@patch('pybossa.cloud_store_api.s3.boto.s3.key.Key.set_contents_from_file')
84908488
def test_task_gold_with_files_in_form(self, set_content):
84918489
"""Test WEB when making a task gold with files"""
84928490

0 commit comments

Comments
 (0)