Skip to content

Commit

Permalink
Merge pull request #693 from dhermes/remove-new-blob-in-regression
Browse files Browse the repository at this point in the history
Removing uses of Bucket.new_blob from regression tests.
  • Loading branch information
dhermes committed Mar 9, 2015
2 parents 3c7316e + 04ba209 commit 83f92cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions gcloud/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

from gcloud import credentials
from gcloud.storage import _implicit_environ
from gcloud.storage.blob import Blob
from gcloud.storage.bucket import Bucket
from gcloud.storage.connection import Connection

Expand Down
14 changes: 7 additions & 7 deletions regression/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def tearDown(self):
class TestStorageWriteFiles(TestStorageFiles):

def test_large_file_write_from_stream(self):
blob = self.bucket.new_blob('LargeFile')
blob = storage.Blob(bucket=self.bucket, name='LargeFile')
self.assertEqual(blob._properties, {})

file_data = self.FILES['big']
Expand All @@ -128,7 +128,7 @@ def test_large_file_write_from_stream(self):
self.assertEqual(blob.md5_hash, file_data['hash'])

def test_small_file_write_from_filename(self):
blob = self.bucket.new_blob('LargeFile')
blob = storage.Blob(bucket=self.bucket, name='LargeFile')
self.assertEqual(blob._properties, {})

file_data = self.FILES['simple']
Expand All @@ -149,12 +149,12 @@ def test_write_metadata(self):
self.assertEqual(blob.content_type, 'image/png')

def test_direct_write_and_read_into_file(self):
blob = self.bucket.new_blob('MyBuffer')
blob = storage.Blob(bucket=self.bucket, name='MyBuffer')
file_contents = 'Hello World'
blob.upload_from_string(file_contents)
self.case_blobs_to_delete.append(blob)

same_blob = self.bucket.new_blob('MyBuffer')
same_blob = storage.Blob(bucket=self.bucket, name='MyBuffer')
temp_filename = tempfile.mktemp()
with open(temp_filename, 'w') as file_obj:
same_blob.download_to_file(file_obj)
Expand Down Expand Up @@ -306,7 +306,7 @@ def setUp(self):
with open(logo_path, 'r') as file_obj:
self.LOCAL_FILE = file_obj.read()

blob = self.bucket.new_blob('LogoToSign.jpg')
blob = storage.Blob(bucket=self.bucket, name='LogoToSign.jpg')
blob.upload_from_string(self.LOCAL_FILE)
self.case_blobs_to_delete.append(blob)

Expand All @@ -316,7 +316,7 @@ def tearDown(self):
blob.delete()

def test_create_signed_read_url(self):
blob = self.bucket.new_blob('LogoToSign.jpg')
blob = storage.Blob(bucket=self.bucket, name='LogoToSign.jpg')
expiration = int(time.time() + 5)
signed_url = blob.generate_signed_url(expiration, method='GET')

Expand All @@ -325,7 +325,7 @@ def test_create_signed_read_url(self):
self.assertEqual(content, self.LOCAL_FILE)

def test_create_signed_delete_url(self):
blob = self.bucket.new_blob('LogoToSign.jpg')
blob = storage.Blob(bucket=self.bucket, name='LogoToSign.jpg')
expiration = int(time.time() + 283473274)
signed_delete_url = blob.generate_signed_url(expiration,
method='DELETE')
Expand Down

0 comments on commit 83f92cc

Please sign in to comment.