Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update catalog API client to use v2 endpoints #587

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']},
)

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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/',
)