Skip to content

Commit

Permalink
test to verify meta url
Browse files Browse the repository at this point in the history
  • Loading branch information
dchhabda committed May 25, 2024
1 parent 2824c30 commit d8853c3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/test_cloud_store_api/test_s3_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ class TestS3Uploader(Test):
}
}

util_config = {
'BCOSV2_PROD_UTIL_URL': "https://s3.storage.env-util.com",
'S3_DEFAULT': {
'host': "s3.storage.env-util.com",
'port': 443,
'auth_headers': [('test', 'name')]
}
}

def test_check_valid_type(self):
with NamedTemporaryFile() as fp:
fp.write(b'hello world')
Expand All @@ -60,6 +69,14 @@ def test_upload_from_string(self, set_contents):
url = s3_upload_from_string('bucket', 'hello world', 'test.txt')
assert url == 'https://s3.storage.com:443/bucket/test.txt', url

@with_context
@patch('pybossa.cloud_store_api.s3.boto.s3.key.Key.set_contents_from_file')
def test_upload_from_string_util(self, set_contents):
with patch.dict(self.flask_app.config, self.util_config):
"""Test -util keyword dropped from meta url returned from s3 upload."""
url = s3_upload_from_string('bucket', 'hello world', 'test.txt')
assert url == 'https://s3.storage.env.com:443/bucket/test.txt', url

@with_context
@patch('pybossa.cloud_store_api.s3.io.open')
def test_upload_from_string_exception(self, open):
Expand Down

0 comments on commit d8853c3

Please sign in to comment.