@pytest.mark.skipif('no_real_s3_credentials()')
def test_backup_list(sts_conn, monkeypatch):
 monkeypatch.setenv('AWS_REGION', 'us-west-1')
 bn = bucket_name_mangle('wal-e.sts.backup.list')
 h = 's3-us-west-1.amazonaws.com'
 cf = connection.OrdinaryCallingFormat()
 fed = sts_conn.get_federation_token('wal-e-test-backup-list', policy=make_policy(bn, 'test-prefix'))
 layout = StorageLayout('s3://{0}/test-prefix'.format(bn))
 creds = Credentials(fed.credentials.access_key, fed.credentials.secret_key, fed.credentials.session_token)
 with FreshBucket(bn, calling_format=cf, host=h) as fb:
  fb.create(location='us-west-1')
  cinfo = calling_format.from_store_name(bn)
  conn = cinfo.connect(creds)
  conn.host = h
  backups = list(BackupList(conn, layout, True))
  assert (not backups)

@ pytest . mark . skipif ( 'no_real_s3_credentials()' ) def test_backup_list ( sts_conn , monkeypatch ) : monkeypatch . setenv ( 'AWS_REGION' , 'us-west-1' ) bn = bucket_name_mangle ( 'wal-e.sts.backup.list' ) h = 's3-us-west-1.amazonaws.com' cf = connection . OrdinaryCallingFormat ( ) fed = sts_conn . get_federation_token ( 'wal-e-test-backup-list' , policy = make_policy ( bn , 'test-prefix' ) ) layout = StorageLayout ( 's3://{0}/test-prefix' . format ( bn ) ) creds = Credentials ( fed . credentials . access_key , fed . credentials . secret_key , fed . credentials . session_token ) with FreshBucket ( bn , calling_format = cf , host = h ) as fb : fb . create ( location = 'us-west-1' ) cinfo = calling_format . from_store_name ( bn ) conn = cinfo . connect ( creds ) conn . host = h backups = list ( BackupList ( conn , layout , True ) ) assert ( not backups )
test backuplists compatibility with a test policy .