Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions codelabs/flex_and_vision/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import uuid

import backoff
from google.api_core.exceptions import GatewayTimeout
import pytest
import requests
import six
Expand Down Expand Up @@ -41,11 +43,15 @@ def test_upload_photo(app):
test_photo_data = requests.get(TEST_PHOTO_URL).content
test_photo_filename = 'flex_and_vision_{}.jpg'.format(uuid.uuid4().hex)

r = app.post(
'/upload_photo',
data={
'file': (six.BytesIO(test_photo_data), test_photo_filename)
}
)
@backoff.on_exception(backoff.expo, GatewayTimeout, max_time=120)
def run_sample():
return app.post(
'/upload_photo',
data={
'file': (six.BytesIO(test_photo_data), test_photo_filename)
}
)

r = run_sample()

assert r.status_code == 302
1 change: 1 addition & 0 deletions codelabs/flex_and_vision/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
backoff==1.10.0
pytest==6.2.1