Skip to content

Commit

Permalink
feat: add content_title to metadata summary api (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnagro authored Oct 23, 2023
1 parent bbaf930 commit 31fb43b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions enterprise_subsidy/apps/api/v1/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1302,11 +1302,12 @@ class ContentMetadataViewSetTests(APITestBase):
content_key_3 = "edX+DemoX3"
course_run_uuid = str(uuid.uuid4())
course_run_key = "edX+DemoX3+20230101"
content_title = "Demonstration Course"
edx_course_metadata = {
"key": content_key_1,
"content_type": "course",
"uuid": content_uuid_1,
"title": "Demonstration Course",
"title": content_title,
"entitlements": [
{
"mode": "verified",
Expand All @@ -1322,7 +1323,7 @@ class ContentMetadataViewSetTests(APITestBase):
"key": content_key_3,
"content_type": "course",
"uuid": content_uuid_3,
"title": "Demonstration Course",
"title": content_title,
"entitlements": [
{
"mode": "verified",
Expand All @@ -1346,7 +1347,7 @@ class ContentMetadataViewSetTests(APITestBase):
"key": content_key_2,
"content_type": "course",
"uuid": content_uuid_2,
"title": "Demonstration Course",
"title": content_title,
"entitlements": [
{
"mode": "paid-executive-education",
Expand All @@ -1370,6 +1371,7 @@ class ContentMetadataViewSetTests(APITestBase):

@ddt.data(
{
'expected_content_title': content_title,
'expected_content_uuid': content_uuid_1,
'expected_content_key': content_key_1,
'expected_course_run_uuid': None,
Expand All @@ -1381,6 +1383,7 @@ class ContentMetadataViewSetTests(APITestBase):
'expected_geag_variant_id': None,
},
{
'expected_content_title': content_title,
'expected_content_uuid': content_uuid_3,
'expected_content_key': content_key_3,
'expected_course_run_uuid': str(course_run_uuid),
Expand All @@ -1392,6 +1395,7 @@ class ContentMetadataViewSetTests(APITestBase):
'expected_geag_variant_id': None,
},
{
'expected_content_title': content_title,
'expected_content_uuid': content_uuid_2,
'expected_content_key': content_key_2,
'expected_course_run_uuid': None,
Expand All @@ -1407,6 +1411,7 @@ class ContentMetadataViewSetTests(APITestBase):
@ddt.unpack
def test_successful_get(
self,
expected_content_title,
expected_content_uuid,
expected_content_key,
expected_course_run_uuid,
Expand All @@ -1428,6 +1433,7 @@ def test_successful_get(
response = self.client.get(url + f'?enterprise_customer_uuid={str(customer_uuid)}')
assert response.status_code == 200
assert response.json() == {
'content_title': expected_content_title,
'content_uuid': str(expected_content_uuid),
'content_key': expected_content_key,
'course_run_key': expected_course_run_key,
Expand All @@ -1444,6 +1450,7 @@ def test_successful_get(
response = self.client.get(url + f'?enterprise_customer_uuid={str(customer_uuid)}')
assert response.status_code == 200
assert response.json() == {
'content_title': expected_content_title,
'content_uuid': str(expected_content_uuid),
'content_key': expected_content_key,
'course_run_key': expected_course_run_key,
Expand Down
1 change: 1 addition & 0 deletions enterprise_subsidy/apps/content_metadata/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def summary_data_for_content(self, content_identifier, content_data):
"""
course_run_content = self.get_course_run(content_identifier, content_data)
return {
'content_title': content_data.get('title'),
'content_uuid': content_data.get('uuid'),
'content_key': content_data.get('key'),
'course_run_uuid': course_run_content.get('uuid'),
Expand Down

0 comments on commit 31fb43b

Please sign in to comment.