ytoprakc commented on code in PR #61790:
URL: https://github.com/apache/airflow/pull/61790#discussion_r2800761171


##########
providers/google/tests/unit/google/cloud/operators/test_gen_ai.py:
##########
@@ -391,6 +525,35 @@ def test_execute(self, mock_hook):
             job_name=TEST_BATCH_JOB_NAME,
         )
 
+    @mock.patch(GEN_AI_PATH.format("GenAIGeminiAPIHook"))
+    def test_execute_propagates_value_error(self, mock_hook):
+        op = GenAIGeminiGetBatchJobOperator(
+            task_id=TASK_ID,
+            project_id=GCP_PROJECT,
+            location=GCP_LOCATION,
+            job_name=TEST_BATCH_JOB_NAME,
+            gcp_conn_id=GCP_CONN_ID,
+            impersonation_chain=IMPERSONATION_CHAIN,
+            gemini_api_key=TEST_GEMINI_API_KEY,
+        )
+
+        mock_hook.return_value.get_batch_job.side_effect = ValueError()
+
+        with pytest.raises(
+            AirflowException, match=f"('Job with name %s not found', 
'{TEST_BATCH_JOB_NAME}')"

Review Comment:
   I have relaxed all unit tests such that they only test for the correct 
exception being raised without the strict message assertions.



-- 
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]

Reply via email to