|
13 | 13 | from __future__ import absolute_import
|
14 | 14 | import os
|
15 | 15 | from unittest import TestCase
|
| 16 | +from unittest.mock import call |
16 | 17 |
|
17 | 18 | from botocore.exceptions import ClientError
|
18 | 19 | from mock.mock import Mock, patch
|
@@ -1932,7 +1933,40 @@ def test_get_default_jumpstart_session_with_user_agent_suffix(
|
1932 | 1933 | botocore_session=mock_boto3_session.get_session.return_value,
|
1933 | 1934 | )
|
1934 | 1935 | mock_boto3_client.assert_has_calls(
|
1935 |
| -======= |
| 1936 | + [ |
| 1937 | + call( |
| 1938 | + "sagemaker", |
| 1939 | + region_name=JUMPSTART_DEFAULT_REGION_NAME, |
| 1940 | + config=mock_botocore_config.return_value, |
| 1941 | + ), |
| 1942 | + call( |
| 1943 | + "sagemaker-runtime", |
| 1944 | + region_name=JUMPSTART_DEFAULT_REGION_NAME, |
| 1945 | + config=mock_botocore_config.return_value, |
| 1946 | + ), |
| 1947 | + ], |
| 1948 | + any_order=True, |
| 1949 | + ) |
| 1950 | + |
| 1951 | + @patch("botocore.client.BaseClient._make_request") |
| 1952 | + def test_get_default_jumpstart_session_with_user_agent_suffix_http_header( |
| 1953 | + self, |
| 1954 | + mock_make_request, |
| 1955 | + ): |
| 1956 | + session = utils.get_default_jumpstart_session_with_user_agent_suffix( |
| 1957 | + "model_id", "model_version" |
| 1958 | + ) |
| 1959 | + try: |
| 1960 | + session.sagemaker_client.list_endpoints() |
| 1961 | + except Exception: |
| 1962 | + pass |
| 1963 | + |
| 1964 | + assert ( |
| 1965 | + "md/js_model_id#model_id md/js_model_ver#model_version" |
| 1966 | + in mock_make_request.call_args[0][1]["headers"]["User-Agent"] |
| 1967 | + ) |
| 1968 | + |
| 1969 | + |
1936 | 1970 | def test_extract_metrics_from_deployment_configs():
|
1937 | 1971 | configs = get_base_deployment_configs_metadata()
|
1938 | 1972 | configs[0].benchmark_metrics = None
|
|
0 commit comments