Skip to content

Commit dd7e0e6

Browse files
committed
fix: fix tests
1 parent a8bbf52 commit dd7e0e6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/idp_common_pkg/tests/unit/classification/test_classification_service.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,19 @@ def test_prepare_prompt_from_template(self, service):
190190
assert result == "Formatted prompt"
191191

192192
@patch("idp_common.s3.get_text_content")
193-
@patch("idp_common.s3.get_binary_content")
193+
@patch("idp_common.image.prepare_image")
194194
@patch(
195195
"idp_common.classification.service.ClassificationService._invoke_bedrock_model"
196196
)
197197
@patch("idp_common.image.prepare_bedrock_image_attachment")
198198
def test_classify_page_bedrock_success(
199-
self, mock_prepare_image, mock_invoke, mock_get_binary, mock_get_text, service
199+
self, mock_prepare_bedrock_image, mock_invoke, mock_prepare_image, mock_get_text, service
200200
):
201201
"""Test successful page classification with Bedrock."""
202202
# Mock responses
203203
mock_get_text.return_value = "This is an invoice for $100"
204-
mock_get_binary.return_value = b"image_data"
205-
mock_prepare_image.return_value = {"image": "base64_encoded_image"}
204+
mock_prepare_image.return_value = b"image_data"
205+
mock_prepare_bedrock_image.return_value = {"image": "base64_encoded_image"}
206206
mock_invoke.return_value = {
207207
"response": {
208208
"output": {"message": {"content": [{"text": '{"class": "invoice"}'}]}}
@@ -227,8 +227,8 @@ def test_classify_page_bedrock_success(
227227

228228
# Verify calls
229229
mock_get_text.assert_called_once_with("s3://bucket/text.txt")
230-
mock_get_binary.assert_called_once_with("s3://bucket/image.jpg")
231-
mock_prepare_image.assert_called_once_with(b"image_data")
230+
mock_prepare_image.assert_called_once_with("s3://bucket/image.jpg", 951, 1268)
231+
mock_prepare_bedrock_image.assert_called_once_with(b"image_data")
232232
mock_invoke.assert_called_once()
233233

234234
@patch("idp_common.s3.get_text_content")

0 commit comments

Comments
 (0)