Beispiel #1
0
 def test_already_exists(self, mock_hook):
     # Exception AlreadyExists not raised, caught in the operator's execute() - idempotence
     op = CloudVisionCreateReferenceImageOperator(
         location=LOCATION_TEST,
         product_id=PRODUCT_ID_TEST,
         reference_image=REFERENCE_IMAGE_TEST,
         task_id='id',
     )
     op.execute(context=None)
     mock_hook.assert_called_once_with(gcp_conn_id=GCP_CONN_ID)
     mock_hook.return_value.create_reference_image.assert_called_once_with(
         location=LOCATION_TEST,
         product_id=PRODUCT_ID_TEST,
         reference_image=REFERENCE_IMAGE_TEST,
         reference_image_id=None,
         project_id=None,
         retry=None,
         timeout=None,
         metadata=None,
     )
Beispiel #2
0
 def test_minimal_green_path(self, mock_hook):
     mock_hook.return_value.create_reference_image.return_value = {}
     op = CloudVisionCreateReferenceImageOperator(
         location=LOCATION_TEST,
         product_id=PRODUCT_ID_TEST,
         reference_image=REFERENCE_IMAGE_TEST,
         task_id='id',
     )
     op.execute(context=None)
     mock_hook.assert_called_once_with(gcp_conn_id=GCP_CONN_ID)
     mock_hook.return_value.create_reference_image.assert_called_once_with(
         location=LOCATION_TEST,
         product_id=PRODUCT_ID_TEST,
         reference_image=REFERENCE_IMAGE_TEST,
         reference_image_id=None,
         project_id=None,
         retry=None,
         timeout=None,
         metadata=None,
     )