@@ -235,6 +235,18 @@ def test_populate_product_catalog_excludes_non_marketable_degrees(self):
235235 authoring_organizations = [self .organization ],
236236 card_image = factory .django .ImageField ()
237237 )
238+ marketable_degree_with_no_language = DegreeFactory .create (
239+ product_source = self .source ,
240+ partner = self .partner ,
241+ additional_metadata = None ,
242+ type = self .program_type ,
243+ status = ProgramStatus .Active ,
244+ marketing_slug = "valid-marketing-slug" ,
245+ title = "Marketable Degree - with empty language field" ,
246+ authoring_organizations = [self .organization ],
247+ card_image = factory .django .ImageField (),
248+ language_override = None ,
249+ )
238250
239251 marketable_degree_2 = DegreeFactory .create (
240252 product_source = self .source ,
@@ -283,6 +295,15 @@ def test_populate_product_catalog_excludes_non_marketable_degrees(self):
283295 self .assertEqual (len (matching_rows ), 1 ,
284296 f"Marketable degree '{ marketable_degree .title } ' should be in the CSV" )
285297
298+ # Check that the marketable degree with no language field is in the CSV
299+ matching_rows = [
300+ row for row in rows if row ["UUID" ] == str (marketable_degree_with_no_language .uuid .hex )
301+ ]
302+ self .assertEqual (len (matching_rows ), 1 ,
303+ f"Marketable degree '{ marketable_degree_with_no_language .title } ' should be in the CSV" )
304+ # Check that the marketable degree with no language field has the default language populated
305+ self .assertEqual (matching_rows [0 ].get ("Languages" ), 'en-us' )
306+
286307 def test_populate_product_catalog_with_degrees_having_overrides (self ):
287308 """
288309 Test that the populate_product_catalog command includes the overridden subjects and languages for degrees.
0 commit comments