Skip to content

Commit

Permalink
test: fix vpc tests (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 authored Sep 11, 2020
1 parent 59d9a2c commit b31ced2
Showing 1 changed file with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,14 @@ def bytes_content_item():
@vpcsc_config.skip_unless_inside_vpcsc
def test_inspect_content_inside(client, name_inside, content_item):
client.inspect_content(
request={"parent": name_inside, "inspect_config": content_item}
request={"parent": name_inside, "item": content_item}
) # no perms issue


@vpcsc_config.skip_unless_inside_vpcsc
def test_inspect_content_outside(client, name_outside, content_item):
with pytest.raises(exceptions.PermissionDenied) as exc:
client.inspect_content(
request={"parent": name_outside, "inspect_config": content_item}
)
client.inspect_content(request={"parent": name_outside, "item": content_item})

assert _VPCSC_PROHIBITED_MESSAGE in exc.value.message

Expand All @@ -72,15 +70,15 @@ def test_inspect_content_outside(client, name_outside, content_item):
def test_redact_image_inside(client, name_inside, bytes_content_item):
with pytest.raises(exceptions.InvalidArgument): # no perms issue
client.redact_image(
request={"parent": name_inside, "location_id": bytes_content_item}
request={"parent": name_inside, "byte_item": bytes_content_item}
)


@vpcsc_config.skip_unless_inside_vpcsc
def test_redact_image_outside(client, name_outside, bytes_content_item):
with pytest.raises(exceptions.PermissionDenied) as exc:
client.redact_image(
request={"parent": name_outside, "location_id": bytes_content_item}
request={"parent": name_outside, "byte_item": bytes_content_item}
)

assert _VPCSC_PROHIBITED_MESSAGE in exc.value.message
Expand All @@ -89,16 +87,14 @@ def test_redact_image_outside(client, name_outside, bytes_content_item):
@vpcsc_config.skip_unless_inside_vpcsc
def test_deidentify_content_inside(client, name_inside, content_item):
with pytest.raises(exceptions.InvalidArgument): # no perms issue
client.deidentify_content(
request={"parent": name_inside, "deidentify_config": content_item}
)
client.deidentify_content(request={"parent": name_inside, "item": content_item})


@vpcsc_config.skip_unless_inside_vpcsc
def test_deidentify_content_outside(client, name_outside, content_item):
with pytest.raises(exceptions.PermissionDenied) as exc:
client.deidentify_content(
request={"parent": name_outside, "deidentify_config": content_item}
request={"parent": name_outside, "item": content_item}
)

assert _VPCSC_PROHIBITED_MESSAGE in exc.value.message
Expand All @@ -107,16 +103,14 @@ def test_deidentify_content_outside(client, name_outside, content_item):
@vpcsc_config.skip_unless_inside_vpcsc
def test_reidentify_content_inside(client, name_inside, content_item):
with pytest.raises(exceptions.InvalidArgument): # no perms issue
client.reidentify_content(
request={"parent": name_inside, "reidentify_config": content_item}
)
client.reidentify_content(request={"parent": name_inside, "item": content_item})


@vpcsc_config.skip_unless_inside_vpcsc
def test_reidentify_content_outside(client, name_outside, content_item):
with pytest.raises(exceptions.PermissionDenied) as exc:
client.reidentify_content(
request={"parent": name_outside, "reidentify_config": content_item}
request={"parent": name_outside, "item": content_item}
)

assert _VPCSC_PROHIBITED_MESSAGE in exc.value.message
Expand Down Expand Up @@ -488,13 +482,17 @@ def test_delete_job_trigger_outside(client, job_trigger_path_outside):
@pytest.fixture(scope="module")
def stored_info_type_path_inside(client):
stored_info_type_id = 1234567
return f"organizations/{vpcsc_config.project_inside}/storedInfoTypes/{stored_info_type_id}"
return (
f"projects/{vpcsc_config.project_inside}/storedInfoTypes/{stored_info_type_id}"
)


@pytest.fixture(scope="module")
def stored_info_type_path_outside(client):
stored_info_type_id = 1234567
return f"organizations/{vpcsc_config.project_outside}/storedInfoTypes/{stored_info_type_id}"
return (
f"projects/{vpcsc_config.project_outside}/storedInfoTypes/{stored_info_type_id}"
)


@pytest.fixture(scope="module")
Expand Down

0 comments on commit b31ced2

Please sign in to comment.