Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token Return #29

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions cloud_blobstore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ def __iter__(self):
next_token = self.token

while True:
self.token = next_token

resp = self.get_api_response(next_token)
listing = self.get_listing_from_response(resp)

self.token = next_token
if self.start_after_key:
while True:
try:
Expand All @@ -84,7 +82,6 @@ def __iter__(self):
if not next_token:
break


class BlobStore:
"""Abstract base class for all blob stores."""
def __init__(self):
Expand Down
17 changes: 17 additions & 0 deletions tests/blobstore_common_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,23 @@ def _testListV2Continuation(self, page_size, break_size):
start_after_key="nonsensicalnonsene"
)]

def testTokenAvailability(self):
blobiter = self.handle.list_v2(
self.test_fixtures_bucket,
"testList/prefix",
k_page_max=1,
)
stop_length = len([x for x in blobiter])

blobiter = self.handle.list_v2(
self.test_fixtures_bucket,
"testList/prefix",
k_page_max=1,
)
for idx, _ in enumerate(blobiter):
if idx >= stop_length - 1:
self.assertTrue(blobiter.token)

def testGetPresignedUrl(self):
presigned_url = self.handle.generate_presigned_GET_url(
self.test_fixtures_bucket,
Expand Down