Skip to content

Commit

Permalink
Revert tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohannes-B committed Jul 20, 2024
1 parent ac0d069 commit e84e2ad
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions tests/test_gcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def test_open_read(self):
"""
data = b"This is some test read data."

self.storage._client = mock.MagicMock()
with self.storage.open(self.filename) as f:
self.storage._client.bucket.assert_called_with(self.bucket_name)
self.storage._bucket.get_blob.assert_called_with(
Expand All @@ -50,7 +49,6 @@ def test_open_read_num_bytes(self):
data = b"This is some test read data."
num_bytes = 10

self.storage._client = mock.MagicMock()
with self.storage.open(self.filename) as f:
self.storage._client.bucket.assert_called_with(self.bucket_name)
self.storage._bucket.get_blob.assert_called_with(
Expand Down Expand Up @@ -109,7 +107,6 @@ def test_save(self):
data = "This is some test content."
content = ContentFile(data)

self.storage._client = mock.MagicMock()
self.storage.save(self.filename, content)

self.storage._client.bucket.assert_called_with(self.bucket_name)
Expand All @@ -127,7 +124,6 @@ def test_save2(self):
filename = "ủⓝï℅ⅆℇ.txt"
content = ContentFile(data)

self.storage._client = mock.MagicMock()
self.storage.save(filename, content)

self.storage._client.bucket.assert_called_with(self.bucket_name)
Expand All @@ -149,7 +145,7 @@ def test_save_with_default_acl(self):
# 'projectPrivate', 'bucketOwnerRead', 'bucketOwnerFullControl',
# 'private', 'authenticatedRead', 'publicRead', 'publicReadWrite'
self.storage.default_acl = "publicRead"
self.storage._client = mock.MagicMock()

self.storage.save(filename, content)

self.storage._client.bucket.assert_called_with(self.bucket_name)
Expand All @@ -163,7 +159,6 @@ def test_save_with_default_acl(self):
)

def test_delete(self):
self.storage._client = mock.MagicMock()
self.storage.delete(self.filename)

self.storage._client.bucket.assert_called_with(self.bucket_name)
Expand All @@ -190,7 +185,6 @@ def test_exists_no_bucket(self):

def test_exists_bucket(self):
# exists('') should return True if the bucket exists
self.storage._client = mock.MagicMock()
self.assertTrue(self.storage.exists(""))

def test_exists_file_overwrite(self):
Expand Down Expand Up @@ -377,7 +371,6 @@ def test_custom_endpoint_with_parameters(self):

self.storage.default_acl = "publicRead"
url = "{}/{}".format(self.storage.custom_endpoint, self.filename)
self.storage._client = mock.MagicMock()
self.assertEqual(self.storage.url(self.filename), url)

bucket_name = "hyacinth"
Expand Down Expand Up @@ -421,7 +414,6 @@ def test_cache_control(self):
GS_OBJECT_PARAMETERS={"cache_control": "public, max-age=604800"}
):
self.storage = gcloud.GoogleCloudStorage(bucket_name=self.bucket_name)
self.storage._client = mock.MagicMock()
self.storage.save(filename, content)
bucket = self.storage.client.bucket(self.bucket_name)
blob = bucket.get_blob(filename)
Expand All @@ -435,7 +427,6 @@ def test_storage_save_gzip_twice(self):
content = ContentFile("I should be gzip'd")

# When
self.storage._client = mock.MagicMock()
self.storage.save(name, content)
self.storage.save("test_storage_save_2.css", content)

Expand Down Expand Up @@ -537,7 +528,6 @@ def test_storage_save_gzipped(self, *args):
patcher = mock.patch("google.cloud.storage.Bucket.get_blob", return_value=blob)
try:
patcher.start()
self.storage._client = mock.MagicMock()
self.storage.save(name, content)
obj = self.storage._bucket.get_blob()
obj.upload_from_file.assert_called_with(
Expand Down Expand Up @@ -565,7 +555,6 @@ def test_storage_save_gzip(self, *args):

try:
patcher.start()
self.storage._client = mock.MagicMock()
self.storage.save(name, content)
obj = self.storage._bucket.get_blob()
obj.upload_from_file.assert_called_with(
Expand Down

0 comments on commit e84e2ad

Please sign in to comment.