From 1b1508e3948cc5ecf6438dca2d7f4431bce8458c Mon Sep 17 00:00:00 2001 From: Troy Sankey Date: Wed, 13 Nov 2024 09:38:56 -0800 Subject: [PATCH] feat: Update catalog API client to use v2 endpoints ENT-9410 --- .../apps/api_client/enterprise_catalog_client.py | 2 +- .../api_client/tests/test_enterprise_catalog_client.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/enterprise_access/apps/api_client/enterprise_catalog_client.py b/enterprise_access/apps/api_client/enterprise_catalog_client.py index f56c064b..d1941530 100644 --- a/enterprise_access/apps/api_client/enterprise_catalog_client.py +++ b/enterprise_access/apps/api_client/enterprise_catalog_client.py @@ -12,7 +12,7 @@ class EnterpriseCatalogApiClient(BaseOAuthClient): """ API client for calls to the enterprise catalog service. """ - api_base_url = settings.ENTERPRISE_CATALOG_URL + '/api/v1/' + api_base_url = settings.ENTERPRISE_CATALOG_URL + '/api/v2/' enterprise_catalog_endpoint = api_base_url + 'enterprise-catalogs/' @backoff.on_exception(wait_gen=backoff.expo, exception=autoretry_for_exceptions) diff --git a/enterprise_access/apps/api_client/tests/test_enterprise_catalog_client.py b/enterprise_access/apps/api_client/tests/test_enterprise_catalog_client.py index ae883ab0..9405c429 100644 --- a/enterprise_access/apps/api_client/tests/test_enterprise_catalog_client.py +++ b/enterprise_access/apps/api_client/tests/test_enterprise_catalog_client.py @@ -34,7 +34,7 @@ def test_contains_content_items(self, mock_oauth_client, mock_json): assert contains_content_items mock_oauth_client.return_value.get.assert_called_with( - f'http://enterprise-catalog.example.com/api/v1/enterprise-catalogs/{ent_uuid}/contains_content_items/', + f'http://enterprise-catalog.example.com/api/v2/enterprise-catalogs/{ent_uuid}/contains_content_items/', params={'course_run_ids': ['AB+CD101']}, ) @@ -65,7 +65,7 @@ def test_catalog_content_metadata(self, mock_oauth_client): self.assertEqual(fetched_metadata['results'], mock_response_json['results']) mock_oauth_client.return_value.get.assert_called_with( - f'http://enterprise-catalog.example.com/api/v1/enterprise-catalogs/{customer_uuid}/get_content_metadata/', + f'http://enterprise-catalog.example.com/api/v2/enterprise-catalogs/{customer_uuid}/get_content_metadata/', params={ 'content_keys': content_keys, 'traverse_pagination': True, @@ -87,7 +87,7 @@ def test_catalog_content_metadata_raises_http_error(self, mock_oauth_client): client.catalog_content_metadata(customer_uuid, content_keys) mock_oauth_client.return_value.get.assert_called_with( - f'http://enterprise-catalog.example.com/api/v1/enterprise-catalogs/{customer_uuid}/get_content_metadata/', + f'http://enterprise-catalog.example.com/api/v2/enterprise-catalogs/{customer_uuid}/get_content_metadata/', params={ 'content_keys': content_keys, 'traverse_pagination': True, @@ -109,5 +109,5 @@ def test_get_content_metadata_count(self, mock_oauth_client): self.assertEqual(fetched_metadata, mock_response_json['count']) mock_oauth_client.return_value.get.assert_called_with( - f'http://enterprise-catalog.example.com/api/v1/enterprise-catalogs/{catalog_uuid}/get_content_metadata/', + f'http://enterprise-catalog.example.com/api/v2/enterprise-catalogs/{catalog_uuid}/get_content_metadata/', )