Skip to content

Commit

Permalink
Use explicit URIs for Video Intelligence sample tests [(#1743)](Googl…
Browse files Browse the repository at this point in the history
  • Loading branch information
alixhami authored and danoscarmike committed Sep 30, 2020
1 parent 6726245 commit a23b589
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
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
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

0 comments on commit a23b589

Please sign in to comment.