|
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | 15 | import os |
16 | | -import uuid |
17 | | - |
18 | | -from google.cloud import automl_v1beta1 as automl |
19 | | -import pytest |
20 | 16 |
|
21 | 17 | import video_object_tracking_create_model |
22 | 18 |
|
23 | 19 | PROJECT_ID = os.environ["GOOGLE_CLOUD_PROJECT"] |
24 | | -DATASET_ID = "VOT2823376535338090496" |
| 20 | +DATASET_ID = "VOT00000000000000000000" |
25 | 21 | OPERATION_ID = None |
26 | 22 |
|
27 | 23 |
|
28 | | -@pytest.fixture(scope="function", autouse=True) |
29 | | -def teardown(): |
30 | | - yield |
31 | | - |
32 | | - # Cancel the training operation |
33 | | - client = automl.AutoMlClient() |
34 | | - client._transport.operations_client.cancel_operation(OPERATION_ID) |
35 | | - |
36 | | - |
37 | 24 | def test_video_classification_create_model(capsys): |
38 | | - model_name = "test_{}".format(uuid.uuid4()).replace("-", "")[:32] |
39 | | - video_object_tracking_create_model.create_model( |
40 | | - PROJECT_ID, DATASET_ID, model_name |
41 | | - ) |
42 | | - out, _ = capsys.readouterr() |
43 | | - assert "Training started" in out |
44 | | - |
45 | | - # Cancel the operation |
46 | | - global OPERATION_ID |
47 | | - OPERATION_ID = out.split("Training operation name: ")[1].split("\n")[0] |
| 25 | + try: |
| 26 | + video_object_tracking_create_model.create_model( |
| 27 | + PROJECT_ID, DATASET_ID, "video_object_test_create_model" |
| 28 | + ) |
| 29 | + out, _ = capsys.readouterr() |
| 30 | + assert "Dataset does not exist." in out |
| 31 | + except Exception as e: |
| 32 | + assert "Dataset does not exist." in e.message |
0 commit comments