def test_public_url_gets_redirect(self): try: global S3Storage from depot.io.awss3 import S3Storage except ImportError: raise SkipTest('Boto not installed') env = os.environ access_key_id = env.get('AWS_ACCESS_KEY_ID') secret_access_key = env.get('AWS_SECRET_ACCESS_KEY') if access_key_id is None or secret_access_key is None: raise SkipTest('Amazon S3 credentials not available') PID = os.getpid() NODE = str(uuid.uuid1()).rsplit('-', 1)[-1] # Travis runs multiple tests concurrently default_bucket_name = 'filedepot-%s' % (access_key_id.lower(), ) cred = (access_key_id, secret_access_key) bucket_name = 'filedepot-testfs-%s-%s-%s' % (access_key_id.lower(), NODE, PID) DepotManager.configure('awss3', {'depot.backend': 'depot.io.awss3.S3Storage', 'depot.access_key_id': access_key_id, 'depot.secret_access_key': secret_access_key, 'depot.bucket': bucket_name}) DepotManager.set_default('awss3') app = self.make_app() new_file = app.post('/create_file').json file_path = DepotManager.url_for('%(uploaded_to)s/%(last)s' % new_file) uploaded_file = app.get(file_path) assert uploaded_file.body == FILE_CONTENT, uploaded_file
def setup(self): DepotManager._clear() try: global S3Storage from depot.io.awss3 import S3Storage except ImportError: raise SkipTest('Boto not installed') env = os.environ access_key_id = env.get('AWS_ACCESS_KEY_ID') secret_access_key = env.get('AWS_SECRET_ACCESS_KEY') if access_key_id is None or secret_access_key is None: raise SkipTest('Amazon S3 credentials not available') PID = os.getpid() NODE = str(uuid.uuid1()).rsplit('-', 1)[-1] # Travis runs multiple tests concurrently default_bucket_name = 'filedepot-%s' % (access_key_id.lower(), ) cred = (access_key_id, secret_access_key) bucket_name = 'filedepot-testfs-%s-%s-%s' % (access_key_id.lower(), NODE, PID) DepotManager.configure('awss3', {'depot.backend': 'depot.io.awss3.S3Storage', 'depot.access_key_id': access_key_id, 'depot.secret_access_key': secret_access_key, 'depot.bucket': bucket_name}) DepotManager.set_default('awss3')
def bind_depot(self): if self.bound_depot_id not in DepotManager._depots: self.create_depot() DepotManager.set_default(self.bound_depot_id)
def test_prevent_non_existing_default(self): DepotManager.set_default('does_not_exists')
def test_changing_default_depot_works(self): DepotManager.configure('first', {'depot.storage_path': './lfs'}) DepotManager.configure('second', {'depot.storage_path': './lfs2'}) DepotManager.set_default('second') assert DepotManager.get_default() == 'second'