Skip to content

Commit

Permalink
test: add unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
AfaqShuaib09 committed Sep 19, 2024
1 parent 7c5831c commit f66eb96
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,18 @@ def test_populate_product_catalog_excludes_non_marketable_degrees(self):
authoring_organizations=[self.organization],
card_image=factory.django.ImageField()
)
marketable_degree_with_no_language = DegreeFactory.create(
product_source=self.source,
partner=self.partner,
additional_metadata=None,
type=self.program_type,
status=ProgramStatus.Active,
marketing_slug="valid-marketing-slug",
title="Marketable Degree - with empty language field",
authoring_organizations=[self.organization],
card_image=factory.django.ImageField(),
language_override=None,
)

marketable_degree_2 = DegreeFactory.create(
product_source=self.source,
Expand Down Expand Up @@ -282,6 +294,15 @@ def test_populate_product_catalog_excludes_non_marketable_degrees(self):
self.assertEqual(len(matching_rows), 1,
f"Marketable degree '{marketable_degree.title}' should be in the CSV")

# Check that the marketable degree with no language field is in the CSV
matching_rows = [
row for row in rows if row["UUID"] == str(marketable_degree_with_no_language.uuid.hex)
]
self.assertEqual(len(matching_rows), 1,
f"Marketable degree '{marketable_degree_with_no_language.title}' should be in the CSV")
# Check that the marketable degree with no language field has the default language populated
self.assertIn("en-us", matching_rows.get("Languages"))

def test_populate_product_catalog_with_degrees_having_overrides(self):
"""
Test that the populate_product_catalog command includes the overridden subjects and languages for degrees.
Expand Down

0 comments on commit f66eb96

Please sign in to comment.