diff --git a/vision/cloud-client/detect/detect_test.py b/vision/cloud-client/detect/detect_test.py index 8dd40b8b264..ac19579546f 100644 --- a/vision/cloud-client/detect/detect_test.py +++ b/vision/cloud-client/detect/detect_test.py @@ -35,6 +35,13 @@ def test_labels_uri(capsys): assert 'Labels' in out +def test_labels_http(capsys): + uri = 'https://storage-download.googleapis.com/{}/vision/wakeupcat.jpg' + detect.detect_labels_uri(uri.format(BUCKET)) + out, _ = capsys.readouterr() + assert 'Labels' in out + + def test_landmarks(capsys): file_name = os.path.join( os.path.dirname(__file__), @@ -51,6 +58,13 @@ def test_landmarks_uri(capsys): assert 'Palace' in out +def test_landmarks_http(capsys): + uri = 'https://storage-download.googleapis.com/{}/vision/landmark.jpg' + detect.detect_landmarks_uri(uri.format(BUCKET)) + out, _ = capsys.readouterr() + assert 'Palace' in out + + def test_faces(capsys): file_name = os.path.join( os.path.dirname(__file__), @@ -67,6 +81,14 @@ def test_faces_uri(capsys): assert 'Likelihood.POSSIBLE' in out +def test_faces_http(capsys): + uri = ('https://storage-download.googleapis.com/{}/vision/' + + 'face_no_surprise.jpg') + detect.detect_faces_uri(uri.format(BUCKET)) + out, _ = capsys.readouterr() + assert 'Likelihood.POSSIBLE' in out + + def test_logos(capsys): file_name = os.path.join( os.path.dirname(__file__), @@ -83,6 +105,13 @@ def test_logos_uri(capsys): assert 'Google' in out +def test_logos_http(capsys): + uri = 'https://storage-download.googleapis.com/{}/vision/logos.png' + detect.detect_logos_uri(uri.format(BUCKET)) + out, _ = capsys.readouterr() + assert 'Google' in out + + def test_safe_search(capsys): file_name = os.path.join( os.path.dirname(__file__), @@ -99,6 +128,13 @@ def test_safe_search_uri(capsys): assert 'Likelihood.VERY_LIKELY' in out +def test_safe_search_http(capsys): + uri = 'https://storage-download.googleapis.com/{}/vision/wakeupcat.jpg' + detect.detect_safe_search_uri(uri.format(BUCKET)) + out, _ = capsys.readouterr() + assert 'Likelihood.VERY_LIKELY' in out + + def test_detect_text(capsys): file_name = os.path.join( os.path.dirname(__file__), @@ -115,6 +151,13 @@ def test_detect_text_uri(capsys): assert '37%' in out +def test_detect_text_http(capsys): + uri = 'https://storage-download.googleapis.com/{}/vision/text.jpg' + detect.detect_text_uri(uri.format(BUCKET)) + out, _ = capsys.readouterr() + assert '37%' in out + + def test_detect_properties(capsys): file_name = os.path.join( os.path.dirname(__file__), @@ -131,6 +174,13 @@ def test_detect_properties_uri(capsys): assert 'frac' in out +def test_detect_properties_http(capsys): + uri = 'https://storage-download.googleapis.com/{}/vision/landmark.jpg' + detect.detect_properties_uri(uri.format(BUCKET)) + out, _ = capsys.readouterr() + assert 'frac' in out + + # Vision 1.1 tests def test_detect_web(capsys): file_name = os.path.join( @@ -148,6 +198,13 @@ def test_detect_web_uri(capsys): assert 'Description: Palace of Fine Arts Theatre' in out +def test_detect_web_http(capsys): + uri = 'https://storage-download.googleapis.com/{}/vision/landmark.jpg' + detect.detect_web_uri(uri.format(BUCKET)) + out, _ = capsys.readouterr() + assert 'Description: Palace of Fine Arts Theatre' in out + + def test_detect_document(capsys): file_name = os.path.join( os.path.dirname(__file__), @@ -164,6 +221,13 @@ def test_detect_document_uri(capsys): assert '37%' in out +def test_detect_document_http(capsys): + uri = 'https://storage-download.googleapis.com/{}/vision/text.jpg' + detect.detect_document_uri(uri.format(BUCKET)) + out, _ = capsys.readouterr() + assert '37%' in out + + def test_detect_crop_hints(capsys): file_name = os.path.join( os.path.dirname(__file__), @@ -178,3 +242,10 @@ def test_detect_crop_hints_uri(capsys): detect.detect_crop_hints_uri(file_name) out, _ = capsys.readouterr() assert 'bounds: (0,0)' in out + + +def test_detect_crop_hints_http(capsys): + uri = 'https://storage-download.googleapis.com/{}/vision/wakeupcat.jpg' + detect.detect_crop_hints_uri(uri.format(BUCKET)) + out, _ = capsys.readouterr() + assert 'bounds: (0,0)' in out