Skip to content

Commit 20f0f7f

Browse files
committed
Split image source tests out.
1 parent 7c4199a commit 20f0f7f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

vision/unit_tests/test_client.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ def test_face_annotation(self):
7272
client._connection._requested[0]['data'])
7373
self.assertTrue('faceAnnotations' in response)
7474

75-
def test_image_with_client(self):
76-
from mock import mock_open
77-
from mock import patch
75+
def test_image_with_client_gcs_source(self):
7876
from google.cloud.vision.image import Image
7977

8078
credentials = _Credentials()
@@ -84,10 +82,24 @@ def test_image_with_client(self):
8482
self.assertIsInstance(gcs_image, Image)
8583
self.assertEqual(gcs_image.source, IMAGE_SOURCE)
8684

85+
def test_image_with_client_raw_content(self):
86+
from google.cloud.vision.image import Image
87+
88+
credentials = _Credentials()
89+
client = self._make_one(project=PROJECT,
90+
credentials=credentials)
8791
raw_image = client.image(content=IMAGE_CONTENT)
8892
self.assertIsInstance(raw_image, Image)
8993
self.assertEqual(raw_image.content, B64_IMAGE_CONTENT)
9094

95+
def test_image_with_client_filename(self):
96+
from mock import mock_open
97+
from mock import patch
98+
from google.cloud.vision.image import Image
99+
100+
credentials = _Credentials()
101+
client = self._make_one(project=PROJECT,
102+
credentials=credentials)
91103
with patch('google.cloud.vision.image.open',
92104
mock_open(read_data=IMAGE_CONTENT)) as m:
93105
file_image = client.image(filename='my_image.jpg')

0 commit comments

Comments
 (0)