@@ -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'
0 commit comments