Skip to content

Commit

Permalink
add a filter to allow state = DONE
Browse files Browse the repository at this point in the history
  • Loading branch information
Takashi Matsuo committed Apr 17, 2020
1 parent bb009db commit eccd521
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
33 changes: 11 additions & 22 deletions dlp/jobs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import os
import uuid

import backoff
import pytest

import jobs
Expand Down Expand Up @@ -62,31 +61,21 @@ def test_job_name():


def test_list_dlp_jobs(test_job_name, capsys):
@backoff.on_exception(backoff.expo,
AssertionError,
max_time=60)
def test_real():
jobs.list_dlp_jobs(GCLOUD_PROJECT)
jobs.list_dlp_jobs(GCLOUD_PROJECT)

out, _ = capsys.readouterr()
assert test_job_name not in out
test_real()
out, _ = capsys.readouterr()
assert test_job_name not in out


def test_list_dlp_jobs_with_filter(test_job_name, capsys):
@backoff.on_exception(backoff.expo,
AssertionError,
max_time=60)
def test_real():
jobs.list_dlp_jobs(
GCLOUD_PROJECT,
filter_string="state=RUNNING",
job_type="RISK_ANALYSIS_JOB",
)

out, _ = capsys.readouterr()
assert test_job_name in out
test_real()
jobs.list_dlp_jobs(
GCLOUD_PROJECT,
filter_string="state=RUNNING OR state=DONE",
job_type="RISK_ANALYSIS_JOB",
)

out, _ = capsys.readouterr()
assert test_job_name in out


def test_list_dlp_jobs_with_job_type(test_job_name, capsys):
Expand Down
2 changes: 1 addition & 1 deletion dlp/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest==5.3.2
flaky==3.6.1
mock==3.0.5
backoff==1.10.0

0 comments on commit eccd521

Please sign in to comment.