def test_analyze_explicit_content(capsys):
    try_count = 0
    while try_count < 3:
        try:
            analyze.analyze_explicit_content(
                "gs://cloud-samples-data/video/cat.mp4")
            out, _ = capsys.readouterr()
            assert "pornography" in out
        except ServiceUnavailable as e:
            # Service is throttling or not available for the moment, sleep for 5 sec and retrying again.
            print("Got service unavailable exception: {}".format(str(e)))
            time.sleep(5)
            continue
        try_count = try_count + 1
        break
def test_analyze_explicit_content(capsys):
    analyze.analyze_explicit_content('gs://{}{}'.format(
        BUCKET, EXPLICIT_CONTENT_FILE_PATH))
    out, _ = capsys.readouterr()
    assert 'pornography' in out
Exemple #3
0
def test_analyze_explicit_content(capsys):
    analyze.analyze_explicit_content("gs://cloud-samples-data/video/cat.mp4")
    out, _ = capsys.readouterr()
    assert "pornography" in out
Exemple #4
0
def test_analyze_explicit_content(capsys):
    analyze.analyze_explicit_content('gs://demomaker/cat.mp4')
    out, _ = capsys.readouterr()
    assert 'pornography' in out
def test_analyze_explicit_content(capsys):
    analyze.analyze_explicit_content(
        'gs://{}{}'.format(BUCKET, EXPLICIT_CONTENT_FILE_PATH))
    out, _ = capsys.readouterr()
    assert 'pornography' in out
def test_analyze_explicit_content(capsys):
    analyze.analyze_explicit_content('gs://cloud-samples-data/video/cat.mp4')
    out, _ = capsys.readouterr()
    assert 'pornography' in out