ferruzzi commented on code in PR #38693: URL: https://github.com/apache/airflow/pull/38693#discussion_r1552572554
########## tests/providers/amazon/aws/hooks/test_bedrock.py: ########## @@ -16,7 +16,70 @@ # under the License. from __future__ import annotations -from airflow.providers.amazon.aws.hooks.bedrock import BedrockRuntimeHook +from unittest import mock + +import pytest +from botocore.exceptions import ClientError + +from airflow.providers.amazon.aws.hooks.bedrock import BedrockHook, BedrockRuntimeHook + +JOB_NAME = "testJobName" +EXPECTED_STATUS = "InProgress" + + [email protected] +def mock_conn(): + with mock.patch.object(BedrockHook, "conn") as _conn: + _conn.get_model_customization_job.return_value = {"jobName": JOB_NAME, "status": EXPECTED_STATUS} + yield _conn + + +class TestBedrockHook: + def setup_method(self): + self.hook = BedrockHook() + + self.validation_exception_error = ClientError( + error_response={"Error": {"Code": "ValidationException", "Message": ""}}, + operation_name="GetModelCustomizationJob", + ) + + self.unexpected_exception = ClientError( + error_response={"Error": {"Code": "ExpiredTokenException", "Message": ""}}, + operation_name="GetModelCustomizationJob", + ) Review Comment: Moved to a class-level field. -- 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]
