|
2 | 2 | # -*- coding: utf-8 -*--
|
3 | 3 | # Copyright (c) 2024, 2025 Oracle and/or its affiliates.
|
4 | 4 | # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
|
| 5 | +import json |
5 | 6 | from unicodedata import category
|
6 | 7 | from unittest import TestCase
|
7 | 8 | from unittest.mock import MagicMock, patch, ANY
|
@@ -272,11 +273,13 @@ def test_get_valid_path(self, mock_urlparse, mock_from_id):
|
272 | 273 | mock_urlparse.return_value = request_path
|
273 | 274 |
|
274 | 275 | model_mock = MagicMock()
|
275 |
| - model_mock.get_custom_metadata_artifact.return_value = "chat_template_string" |
| 276 | + model_mock.get_custom_metadata_artifact.return_value = b"chat_template_string" |
276 | 277 | mock_from_id.return_value = model_mock
|
277 | 278 |
|
278 | 279 | self.model_chat_template_handler.get(model_id="test_model_id")
|
279 |
| - self.model_chat_template_handler.finish.assert_called_with("chat_template_string") |
| 280 | + self.model_chat_template_handler.finish.assert_called_with( |
| 281 | + json.dumps({"chat_template": "chat_template_string"}) |
| 282 | + ) |
280 | 283 | model_mock.get_custom_metadata_artifact.assert_called_with("chat_template")
|
281 | 284 |
|
282 | 285 | @patch("ads.aqua.extension.model_handler.urlparse")
|
@@ -361,7 +364,7 @@ def test_post_model_not_found(self, mock_write_error, mock_from_id):
|
361 | 364 | _, exc_instance, _ = exc_info
|
362 | 365 | assert isinstance(exc_instance, HTTPError)
|
363 | 366 | assert exc_instance.status_code == 404
|
364 |
| - assert "Model not found" in str(exc_instance) |
| 367 | + assert "Model not found for id" in str(exc_instance) |
365 | 368 |
|
366 | 369 |
|
367 | 370 | class TestAquaHuggingFaceHandler:
|
|
0 commit comments