uranusjr commented on code in PR #23025:
URL: https://github.com/apache/airflow/pull/23025#discussion_r851129116
##########
tests/providers/google/cloud/operators/test_looker.py:
##########
@@ -146,3 +149,21 @@ def test_on_kill(self, mock_hook):
task.cancel_on_kill = True
task.on_kill()
mock_hook.return_value.stop_pdt_build.assert_called_once_with(materialization_id=TEST_JOB_ID)
+
+ @mock.patch(OPERATOR_PATH.format("LookerHook"))
+ def test_materialization_id_returned_as_empty_str(self, mock_hook):
+ # mock return vals from hook
+ mock_hook.return_value.start_pdt_build.return_value.materialization_id
= ""
+ mock_hook.return_value.wait_for_job.return_value = None
+
+ # run task in mock context (asynchronous=False)
+ task = LookerStartPdtBuildOperator(
+ task_id=TASK_ID,
+ looker_conn_id=LOOKER_CONN_ID,
+ model=MODEL,
+ view=VIEW,
+ )
+
+ # check AirflowException is raised
+ with pytest.raises(AirflowException, match="No `materialization_id`
was returned"):
Review Comment:
```suggestion
with pytest.raises(AirflowException, match="^No `materialization_id`
was returned$"):
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]