Skip to content

Commit 6c5cfc7

Browse files
committed
Add systests for listing bucket blobs (V2/V4).
1 parent 68742be commit 6c5cfc7

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

storage/tests/system.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import time
2020
import unittest
2121

22+
import pytest
2223
import requests
2324
import six
2425

@@ -752,6 +753,42 @@ def tearDown(self):
752753
if blob.exists():
753754
retry(blob.delete)()
754755

756+
def _create_signed_list_blobs_url_helper(
757+
self, version, expiration=None, max_age=None, method="GET"
758+
):
759+
if expiration is None and max_age is None:
760+
max_age = 10
761+
762+
signed_url = self.bucket.generate_signed_url(
763+
expiration=expiration,
764+
max_age=max_age,
765+
method=method,
766+
client=Config.CLIENT,
767+
version=version,
768+
)
769+
770+
response = requests.get(signed_url)
771+
self.assertEqual(response.status_code, 200)
772+
773+
def test_create_signed_list_blobs_url_v2(self):
774+
self._create_signed_list_blobs_url_helper(version="v2")
775+
776+
def test_create_signed_list_blobs_url_v2_w_expiration(self):
777+
now = datetime.datetime.utcnow()
778+
delta = datetime.timedelta(seconds=10)
779+
780+
self._create_signed_list_blobs_url_helper(expiration=now + delta, version="v2")
781+
782+
@pytest.mark.skip(reason="Back-end case-flattening bug: revisit 2019-04-03")
783+
def test_create_signed_list_blobs_url_v4(self):
784+
self._create_signed_list_blobs_url_helper(version="v4")
785+
786+
@pytest.mark.skip(reason="Back-end case-flattening bug: revisit 2019-04-03")
787+
def test_create_signed_list_blobs_url_v4_w_expiration(self):
788+
now = datetime.datetime.utcnow()
789+
delta = datetime.timedelta(seconds=10)
790+
self._create_signed_list_blobs_url_helper(expiration=now + delta, version="v4")
791+
755792
def _create_signed_read_url_helper(
756793
self,
757794
blob_name="LogoToSign.jpg",

0 commit comments

Comments
 (0)