Skip to content

Commit

Permalink
Add systests for listing bucket blobs (V2/V4).
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Apr 1, 2019
1 parent 68742be commit 6c5cfc7
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions storage/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import time
import unittest

import pytest
import requests
import six

Expand Down Expand Up @@ -752,6 +753,42 @@ def tearDown(self):
if blob.exists():
retry(blob.delete)()

def _create_signed_list_blobs_url_helper(
self, version, expiration=None, max_age=None, method="GET"
):
if expiration is None and max_age is None:
max_age = 10

signed_url = self.bucket.generate_signed_url(
expiration=expiration,
max_age=max_age,
method=method,
client=Config.CLIENT,
version=version,
)

response = requests.get(signed_url)
self.assertEqual(response.status_code, 200)

def test_create_signed_list_blobs_url_v2(self):
self._create_signed_list_blobs_url_helper(version="v2")

def test_create_signed_list_blobs_url_v2_w_expiration(self):
now = datetime.datetime.utcnow()
delta = datetime.timedelta(seconds=10)

self._create_signed_list_blobs_url_helper(expiration=now + delta, version="v2")

@pytest.mark.skip(reason="Back-end case-flattening bug: revisit 2019-04-03")
def test_create_signed_list_blobs_url_v4(self):
self._create_signed_list_blobs_url_helper(version="v4")

@pytest.mark.skip(reason="Back-end case-flattening bug: revisit 2019-04-03")
def test_create_signed_list_blobs_url_v4_w_expiration(self):
now = datetime.datetime.utcnow()
delta = datetime.timedelta(seconds=10)
self._create_signed_list_blobs_url_helper(expiration=now + delta, version="v4")

def _create_signed_read_url_helper(
self,
blob_name="LogoToSign.jpg",
Expand Down

0 comments on commit 6c5cfc7

Please sign in to comment.