@@ -35,6 +35,13 @@ def test_labels_uri(capsys):
35
35
assert 'Labels' in out
36
36
37
37
38
+ def test_labels_http (capsys ):
39
+ uri = 'https://storage-download.googleapis.com/{}/vision/wakeupcat.jpg'
40
+ detect .detect_labels_uri (uri .format (BUCKET ))
41
+ out , _ = capsys .readouterr ()
42
+ assert 'Labels' in out
43
+
44
+
38
45
def test_landmarks (capsys ):
39
46
file_name = os .path .join (
40
47
os .path .dirname (__file__ ),
@@ -51,6 +58,13 @@ def test_landmarks_uri(capsys):
51
58
assert 'Palace' in out
52
59
53
60
61
+ def test_landmarks_http (capsys ):
62
+ uri = 'https://storage-download.googleapis.com/{}/vision/landmark.jpg'
63
+ detect .detect_landmarks_uri (uri .format (BUCKET ))
64
+ out , _ = capsys .readouterr ()
65
+ assert 'Palace' in out
66
+
67
+
54
68
def test_faces (capsys ):
55
69
file_name = os .path .join (
56
70
os .path .dirname (__file__ ),
@@ -67,6 +81,14 @@ def test_faces_uri(capsys):
67
81
assert 'Likelihood.POSSIBLE' in out
68
82
69
83
84
+ def test_faces_http (capsys ):
85
+ uri = ('https://storage-download.googleapis.com/{}/vision/' +
86
+ 'face_no_surprise.jpg' )
87
+ detect .detect_faces_uri (uri .format (BUCKET ))
88
+ out , _ = capsys .readouterr ()
89
+ assert 'Likelihood.POSSIBLE' in out
90
+
91
+
70
92
def test_logos (capsys ):
71
93
file_name = os .path .join (
72
94
os .path .dirname (__file__ ),
@@ -83,6 +105,13 @@ def test_logos_uri(capsys):
83
105
assert 'Google' in out
84
106
85
107
108
+ def test_logos_http (capsys ):
109
+ uri = 'https://storage-download.googleapis.com/{}/vision/logos.png'
110
+ detect .detect_logos_uri (uri .format (BUCKET ))
111
+ out , _ = capsys .readouterr ()
112
+ assert 'Google' in out
113
+
114
+
86
115
def test_safe_search (capsys ):
87
116
file_name = os .path .join (
88
117
os .path .dirname (__file__ ),
@@ -99,6 +128,13 @@ def test_safe_search_uri(capsys):
99
128
assert 'Likelihood.VERY_LIKELY' in out
100
129
101
130
131
+ def test_safe_search_http (capsys ):
132
+ uri = 'https://storage-download.googleapis.com/{}/vision/wakeupcat.jpg'
133
+ detect .detect_safe_search_uri (uri .format (BUCKET ))
134
+ out , _ = capsys .readouterr ()
135
+ assert 'Likelihood.VERY_LIKELY' in out
136
+
137
+
102
138
def test_detect_text (capsys ):
103
139
file_name = os .path .join (
104
140
os .path .dirname (__file__ ),
@@ -115,6 +151,13 @@ def test_detect_text_uri(capsys):
115
151
assert '37%' in out
116
152
117
153
154
+ def test_detect_text_http (capsys ):
155
+ uri = 'https://storage-download.googleapis.com/{}/vision/text.jpg'
156
+ detect .detect_text_uri (uri .format (BUCKET ))
157
+ out , _ = capsys .readouterr ()
158
+ assert '37%' in out
159
+
160
+
118
161
def test_detect_properties (capsys ):
119
162
file_name = os .path .join (
120
163
os .path .dirname (__file__ ),
@@ -131,6 +174,13 @@ def test_detect_properties_uri(capsys):
131
174
assert 'frac' in out
132
175
133
176
177
+ def test_detect_properties_http (capsys ):
178
+ uri = 'https://storage-download.googleapis.com/{}/vision/landmark.jpg'
179
+ detect .detect_properties_uri (uri .format (BUCKET ))
180
+ out , _ = capsys .readouterr ()
181
+ assert 'frac' in out
182
+
183
+
134
184
# Vision 1.1 tests
135
185
def test_detect_web (capsys ):
136
186
file_name = os .path .join (
@@ -148,6 +198,13 @@ def test_detect_web_uri(capsys):
148
198
assert 'Description: Palace of Fine Arts Theatre' in out
149
199
150
200
201
+ def test_detect_web_http (capsys ):
202
+ uri = 'https://storage-download.googleapis.com/{}/vision/landmark.jpg'
203
+ detect .detect_web_uri (uri .format (BUCKET ))
204
+ out , _ = capsys .readouterr ()
205
+ assert 'Description: Palace of Fine Arts Theatre' in out
206
+
207
+
151
208
def test_detect_document (capsys ):
152
209
file_name = os .path .join (
153
210
os .path .dirname (__file__ ),
@@ -164,6 +221,13 @@ def test_detect_document_uri(capsys):
164
221
assert '37%' in out
165
222
166
223
224
+ def test_detect_document_http (capsys ):
225
+ uri = 'https://storage-download.googleapis.com/{}/vision/text.jpg'
226
+ detect .detect_document_uri (uri .format (BUCKET ))
227
+ out , _ = capsys .readouterr ()
228
+ assert '37%' in out
229
+
230
+
167
231
def test_detect_crop_hints (capsys ):
168
232
file_name = os .path .join (
169
233
os .path .dirname (__file__ ),
@@ -178,3 +242,10 @@ def test_detect_crop_hints_uri(capsys):
178
242
detect .detect_crop_hints_uri (file_name )
179
243
out , _ = capsys .readouterr ()
180
244
assert 'bounds: (0,0)' in out
245
+
246
+
247
+ def test_detect_crop_hints_http (capsys ):
248
+ uri = 'https://storage-download.googleapis.com/{}/vision/wakeupcat.jpg'
249
+ detect .detect_crop_hints_uri (uri .format (BUCKET ))
250
+ out , _ = capsys .readouterr ()
251
+ assert 'bounds: (0,0)' in out
0 commit comments