8000 Add pseudo delete test · mmmarklu/python-docs-samples@aaa917d · GitHub
[go: up one dir, main page]

Skip to content

Commit aaa917d

Browse files
committed
Add pseudo delete test
1 parent 60a53c8 commit aaa917d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

translate/automl/model_management_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import list_operation_status
2626
import get_operation_status
2727
import create_model
28+
import delete_model
2829

2930
project_id = os.environ['GCLOUD_PROJECT']
3031
dataset_id = 'TRL3876092572857648864'
@@ -76,3 +77,14 @@ def test_create_model(capsys):
7677
from google.cloud import automl
7778
client = automl.AutoMlClient()
7879
client.transport._operations_client.cancel_operation(operation_id)
80+
81+
82+
@pytest.mark.slow
83+
def test_delete_model(capsys):
84+
# As model creation can take many hours, instead try to delete a
85+
# nonexistent model and confirm that the model was not found, but other
86+
# elements of the request were valid.
87+
delete_model.delete_model(project_id, 'TRL0000000000000000000')
88+
out, _ = capsys.readouterr()
89+
assert 'status = StatusCode.NOT_FOUND' in out
90+
assert 'details = "The model does not exist."' in out

0 commit comments

Comments
 (0)
0