def test_get_buckets(self): buckets_to_create = [ 'new%d' % (1000 * time.time(),), 'newer%d' % (1000 * time.time(),), 'newest%d' % (1000 * time.time(),), ] created_buckets = [] for bucket_name in buckets_to_create: bucket = storage.create_bucket(bucket_name) self.case_buckets_to_delete.append(bucket_name) # Retrieve the buckets. all_buckets = storage.list_buckets() created_buckets = [bucket for bucket in all_buckets if bucket.name in buckets_to_create] self.assertEqual(len(created_buckets), len(buckets_to_create))
def list_buckets(connection): return list(storage.list_buckets(project=PROJECT_ID, connection=connection))