@@ -334,13 +334,13 @@ def test_abstract_changelogs_rel_current_dir_path(patches):
334334@pytest .mark .parametrize (
335335 "raises" ,
336336 [None , Exception , yaml .reader .ReaderError , exceptions .TypeCastingError ])
337- def test_abstract_changelogs_sections (patches , raises ):
337+ def test_abstract_changelogs_config (patches , raises ):
338338 changelogs = DummyChangelogs ("PROJECT" )
339339 patched = patches (
340340 "cast" ,
341341 "utils.from_yaml" ,
342342 "logger" ,
343- ("AChangelogs.sections_path " ,
343+ ("AChangelogs.config_path " ,
344344 dict (new_callable = PropertyMock )),
345345 prefix = "envoy.base.utils.abstract.project.changelog" )
346346
@@ -350,53 +350,89 @@ def test_abstract_changelogs_sections(patches, raises):
350350 m_yaml .side_effect = error
351351 if raises == Exception :
352352 with pytest .raises (Exception ):
353- changelogs .sections
353+ changelogs .config
354354 elif raises == yaml .reader .ReaderError :
355355 with pytest .raises (exceptions .ChangelogError ) as e :
356- changelogs .sections
356+ changelogs .config
357357 else :
358358 assert (
359- changelogs .sections
359+ changelogs .config
360360 == (m_yaml .return_value
361361 if not raises
362362 else m_cast .return_value ))
363363
364364 if raises == exceptions .TypeCastingError :
365365 assert (
366366 m_cast .call_args
367- == [(typing .ChangelogSectionsDict , error .value ), {}])
367+ == [(typing .ChangelogConfigDict , error .value ), {}])
368368 assert (
369369 m_logger .warning .call_args
370- == [("Changelog section parsing error: "
370+ == [("Changelog config parsing error: "
371371 f"({ m_path .return_value } )\n { error } " , ), {}])
372372 else :
373373 assert not m_logger .called
374374 assert not m_cast .called
375375
376376 assert (
377377 m_yaml .call_args
378- == [(m_path .return_value , typing .ChangelogSectionsDict ), {}])
378+ == [(m_path .return_value , typing .ChangelogConfigDict ), {}])
379379 assert (
380- ("sections " in changelogs .__dict__ )
380+ ("config " in changelogs .__dict__ )
381381 == (not raises or raises == exceptions .TypeCastingError ))
382382 if raises != yaml .reader .ReaderError :
383383 return
384384 assert (
385385 e .value .args [0 ]
386- == ("Failed to parse changelog sections "
386+ == ("Failed to parse changelog config "
387387 f"({ m_path .return_value } ): { str (error )} " ))
388388
389389
390- def test_abstract_changelogs_sections_path ():
390+ def test_abstract_changelogs_sections (patches ):
391+ changelogs = DummyChangelogs ("PROJECT" )
392+ patched = patches (
393+ ("AChangelogs.config" ,
394+ dict (new_callable = PropertyMock )),
395+ prefix = "envoy.base.utils.abstract.project.changelog" )
396+
397+ with patched as (m_config , ):
398+ assert (
399+ changelogs .sections
400+ == m_config .return_value .__getitem__ .return_value )
401+
402+ assert (
403+ m_config .return_value .__getitem__ .call_args
404+ == [("sections" , ), {}])
405+ assert "sections" in changelogs .__dict__
406+
407+
408+ def test_abstract_changelogs_areas (patches ):
409+ changelogs = DummyChangelogs ("PROJECT" )
410+ patched = patches (
411+ ("AChangelogs.config" ,
412+ dict (new_callable = PropertyMock )),
413+ prefix = "envoy.base.utils.abstract.project.changelog" )
414+
415+ with patched as (m_config , ):
416+ assert (
417+ changelogs .areas
418+ == m_config .return_value .__getitem__ .return_value )
419+
420+ assert (
421+ m_config .return_value .__getitem__ .call_args
422+ == [("areas" , ), {}])
423+ assert "areas" in changelogs .__dict__
424+
425+
426+ def test_abstract_changelogs_config_path ():
391427 project = MagicMock ()
392428 changelogs = DummyChangelogs (project )
393429 assert (
394- changelogs .sections_path
430+ changelogs .config_path
395431 == project .path .joinpath .return_value )
396432 assert (
397433 project .path .joinpath .call_args
398- == [(abstract .project .changelog .CHANGELOG_SECTIONS_PATH , ), {}])
399- assert "sections_path " not in changelogs .__dict__
434+ == [(abstract .project .changelog .CHANGELOG_CONFIG_PATH , ), {}])
435+ assert "config_path " not in changelogs .__dict__
400436
401437
402438def test_abstract_changelogs_validate_sections ():
@@ -423,7 +459,7 @@ def test_abstract_changelogs_validate_sections_unknown(path):
423459
424460 message = e .value .args [0 ]
425461 assert "unknown" in message
426- assert abstract .project .changelog .CHANGELOG_SECTIONS_PATH in message
462+ assert abstract .project .changelog .CHANGELOG_CONFIG_PATH in message
427463 if path is None :
428464 assert "changelogs/current.yaml" not in message
429465 assert "(None)" not in message
@@ -1737,9 +1773,10 @@ async def test_abstract_changelog_data_unknown_section(tmp_path):
17371773 "unknown:\n "
17381774 " - area: api\n "
17391775 " change: changed\n " )
1740- tmp_path .joinpath ("changelogs/sections.yaml" ).write_text (
1741- "known:\n "
1742- " title: Known\n " )
1776+ tmp_path .joinpath ("changelogs/changelogs.yaml" ).write_text (
1777+ "sections:\n "
1778+ " known:\n "
1779+ " title: Known\n " )
17431780
17441781 project = MagicMock ()
17451782 project .path = tmp_path
0 commit comments