Skip to content

Commit f25f21b

Browse files
authored
chore: minor updates to support new GEAG API response structure (#4471)
1 parent db224a6 commit f25f21b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

course_discovery/apps/course_metadata/management/commands/populate_executive_education_data_csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def get_variants(self, product):
176176
Returns:
177177
list: A list of variant dicts
178178
"""
179-
variant_keys = ['variant', 'variants', 'future_variants', 'custom_presentations']
179+
variant_keys = ['variant', 'variants', 'futureVariants', 'customPresentations']
180180
variants = []
181181

182182
for key in variant_keys:

course_discovery/apps/course_metadata/management/commands/tests/test_populate_executive_education_data_csv.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ class TestPopulateExecutiveEducationDataCsv(CSVLoaderMixin, TestCase):
148148

149149
SUCCESS_API_RESPONSE_CUSTOM_AND_FUTURE_VARIANTS = copy.deepcopy(SUCCESS_API_RESPONSE)
150150
SUCCESS_API_RESPONSE_CUSTOM_AND_FUTURE_VARIANTS['products'][0].update({
151-
'custom_presentations': [{**copy.deepcopy(variant_1), 'websiteVisibility': 'private', 'status': 'active'}],
152-
'future_variants': [
151+
'customPresentations': [{**copy.deepcopy(variant_1), 'websiteVisibility': 'private', 'status': 'active'}],
152+
'futureVariants': [
153153
{
154154
**copy.deepcopy(variant_2), 'websiteVisibility': 'public', 'status': 'scheduled',
155155
'startDate': '2026-03-20', 'endDate': '2026-04-28', 'finalRegCloseDate': '2026-03-26'
@@ -264,10 +264,10 @@ def test_populate_executive_education_data_csv_with_new_variants_structure_chang
264264
)
265265

266266
simple_variant = self.SUCCESS_API_RESPONSE_CUSTOM_AND_FUTURE_VARIANTS["products"][0]["variant"]
267-
future_variant = self.SUCCESS_API_RESPONSE_CUSTOM_AND_FUTURE_VARIANTS["products"][0]["future_variants"][0]
267+
future_variant = self.SUCCESS_API_RESPONSE_CUSTOM_AND_FUTURE_VARIANTS["products"][0]["futureVariants"][0]
268268
custom_variant = self.SUCCESS_API_RESPONSE_CUSTOM_AND_FUTURE_VARIANTS[
269269
"products"
270-
][0]["custom_presentations"][0]
270+
][0]["customPresentations"][0]
271271

272272
with open(output_csv.name, "r") as csv_file:
273273
reader = csv.DictReader(csv_file)
@@ -284,13 +284,15 @@ def test_populate_executive_education_data_csv_with_new_variants_structure_chang
284284
assert data_row["Start Date"] == future_variant["startDate"]
285285
assert data_row["End Date"] == future_variant["endDate"]
286286
assert data_row["Reg Close Date"] == future_variant["finalRegCloseDate"]
287+
assert data_row["Publish Date"] == future_variant["startDate"]
287288
assert data_row["Restriction Type"] == "None"
288289

289290
data_row = next(reader)
290291
assert data_row["Variant Id"] == custom_variant["id"]
291292
assert data_row["Start Date"] == custom_variant["startDate"]
292293
assert data_row["End Date"] == custom_variant["endDate"]
293294
assert data_row["Reg Close Date"] == custom_variant["finalRegCloseDate"]
295+
assert data_row["Publish Date"] == str(date.today().isoformat())
294296
assert data_row["Restriction Type"] == "custom-b2b-enterprise"
295297

296298
@mock.patch('course_discovery.apps.course_metadata.utils.GetSmarterEnterpriseApiClient')

0 commit comments

Comments
 (0)