Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use explicit URIs for Video Intelligence sample tests #1743

Merged
merged 4 commits into from
Oct 10, 2018
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
17 changes: 3 additions & 14 deletions video/cloud-client/analyze/analyze_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

import pytest

import analyze


BUCKET = os.environ['CLOUD_STORAGE_BUCKET']
LABELS_FILE_PATH = '/video/cat.mp4'
EXPLICIT_CONTENT_FILE_PATH = '/video/cat.mp4'
SHOTS_FILE_PATH = '/video/gbikes_dinosaur.mp4'


@pytest.mark.slow
def test_analyze_shots(capsys):
analyze.analyze_shots(
'gs://{}{}'.format(BUCKET, SHOTS_FILE_PATH))
analyze.analyze_shots('gs://demomaker/gbikes_dinosaur.mp4')
out, _ = capsys.readouterr()
assert 'Shot 1:' in out


@pytest.mark.slow
def test_analyze_labels(capsys):
analyze.analyze_labels(
'gs://{}{}'.format(BUCKET, LABELS_FILE_PATH))
analyze.analyze_labels('gs://demomaker/cat.mp4')
out, _ = capsys.readouterr()
assert 'label description: cat' in out


@pytest.mark.slow
def test_analyze_explicit_content(capsys):
analyze.analyze_explicit_content(
'gs://{}{}'.format(BUCKET, EXPLICIT_CONTENT_FILE_PATH))
analyze.analyze_explicit_content('gs://demomaker/cat.mp4')
out, _ = capsys.readouterr()
assert 'pornography' in out
7 changes: 1 addition & 6 deletions video/cloud-client/analyze/beta_snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

import pytest

import beta_snippets

BUCKET = os.environ['CLOUD_STORAGE_BUCKET']
FILE_PATH = 'video/googlework_short.mp4'


@pytest.mark.slow
def test_speech_transcription(capsys):
beta_snippets.speech_transcription(
'gs://{}/{}'.format(BUCKET, FILE_PATH))
'gs://python-docs-samples-tests/video/googlework_short.mp4')
out, _ = capsys.readouterr()
assert 'cultural' in out
9 changes: 1 addition & 8 deletions video/cloud-client/labels/labels_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

import pytest

import labels


BUCKET = os.environ['CLOUD_STORAGE_BUCKET']
LABELS_FILE_PATH = '/video/cat.mp4'


@pytest.mark.slow
def test_feline_video_labels(capsys):
labels.analyze_labels(
'gs://{}{}'.format(BUCKET, LABELS_FILE_PATH))
labels.analyze_labels('gs://demomaker/cat.mp4')
out, _ = capsys.readouterr()
assert 'Video label description: cat' in out
8 changes: 1 addition & 7 deletions video/cloud-client/shotchange/shotchange_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os

import pytest

import shotchange

BUCKET = os.environ['CLOUD_STORAGE_BUCKET']
SHOTS_FILE_PATH = '/video/gbikes_dinosaur.mp4'


@pytest.mark.slow
def test_shots_dino(capsys):
shotchange.analyze_shots(
'gs://{}{}'.format(BUCKET, SHOTS_FILE_PATH))
shotchange.analyze_shots('gs://demomaker/gbikes_dinosaur.mp4')
out, _ = capsys.readouterr()
assert 'Shot 1:' in out