@@ -18,7 +18,7 @@ def test_init_with_component(self, component_dir, sample_extracted_metadata):
1818 )
1919
2020 assert generator .metadata == sample_extracted_metadata
21- assert generator .yaml_metadata is not None
21+ assert generator .feature_metadata is not None
2222
2323 def test_init_with_pipeline (self , pipeline_dir , sample_extracted_metadata ):
2424 """Test initialization with pipeline metadata."""
@@ -29,18 +29,18 @@ def test_init_with_pipeline(self, pipeline_dir, sample_extracted_metadata):
2929
3030 assert generator .metadata == sample_extracted_metadata
3131
32- def test_load_yaml_metadata (self , component_dir , sample_extracted_metadata ):
32+ def test_load_feature_metadata (self , component_dir , sample_extracted_metadata ):
3333 """Test loading YAML metadata from file."""
3434 generator = ReadmeContentGenerator (
3535 sample_extracted_metadata ,
3636 component_dir
3737 )
3838
39- assert 'name' in generator .yaml_metadata
40- assert generator .yaml_metadata ['name' ] == 'sample_component'
41- assert 'tier' in generator .yaml_metadata
39+ assert 'name' in generator .feature_metadata
40+ assert generator .feature_metadata ['name' ] == 'sample_component'
41+ assert 'tier' in generator .feature_metadata
4242
43- def test_load_yaml_metadata_excludes_ci (self , temp_dir , sample_extracted_metadata ):
43+ def test_load_feature_metadata_excludes_ci (self , temp_dir , sample_extracted_metadata ):
4444 """Test that 'ci' field is excluded from YAML metadata."""
4545 metadata_file = temp_dir / "metadata.yaml"
4646 metadata_file .write_text ("""name: test
@@ -55,9 +55,69 @@ def test_load_yaml_metadata_excludes_ci(self, temp_dir, sample_extracted_metadat
5555 temp_dir
5656 )
5757
58- assert 'ci' not in generator .yaml_metadata
59- assert 'name' in generator .yaml_metadata
60- assert 'tier' in generator .yaml_metadata
58+ assert 'ci' not in generator .feature_metadata
59+ assert 'name' in generator .feature_metadata
60+ assert 'tier' in generator .feature_metadata
61+
62+ def test_load_owners_file_exists (self , component_dir , sample_extracted_metadata ):
63+ """Test loading OWNERS file when it exists."""
64+ # Create an OWNERS file
65+ owners_file = component_dir / "OWNERS"
66+ owners_file .write_text ("""approvers:
67+ - user1
68+ - user2
69+ reviewers:
70+ - user3
71+ - user4
72+ """ )
73+
74+ generator = ReadmeContentGenerator (
75+ sample_extracted_metadata ,
76+ component_dir
77+ )
78+
79+ # Check that owners were loaded into feature_metadata
80+ assert 'owners' in generator .feature_metadata
81+ assert 'approvers' in generator .feature_metadata ['owners' ]
82+ assert 'reviewers' in generator .feature_metadata ['owners' ]
83+ assert generator .feature_metadata ['owners' ]['approvers' ] == ['user1' , 'user2' ]
84+ assert generator .feature_metadata ['owners' ]['reviewers' ] == ['user3' , 'user4' ]
85+
86+ def test_load_owners_file_not_exists (self , component_dir , sample_extracted_metadata ):
87+ """Test that missing OWNERS file doesn't cause errors."""
88+ generator = ReadmeContentGenerator (
89+ sample_extracted_metadata ,
90+ component_dir
91+ )
92+
93+ # Should not have owners in feature_metadata when OWNERS doesn't exist
94+ assert 'owners' not in generator .feature_metadata
95+
96+ def test_owners_in_generated_readme (self , component_dir , sample_extracted_metadata ):
97+ """Test that OWNERS data appears in generated README."""
98+ # Create an OWNERS file
99+ owners_file = component_dir / "OWNERS"
100+ owners_file .write_text ("""approvers:
101+ - alice
102+ - bob
103+ reviewers:
104+ - charlie
105+ """ )
106+
107+ generator = ReadmeContentGenerator (
108+ sample_extracted_metadata ,
109+ component_dir
110+ )
111+
112+ readme = generator .generate_readme ()
113+
114+ # Check that owners appear in the README
115+ assert 'Owners' in readme
116+ assert 'alice' in readme
117+ assert 'bob' in readme
118+ assert 'charlie' in readme
119+ assert 'Approvers' in readme or 'approvers' in readme .lower ()
120+ assert 'Reviewers' in readme or 'reviewers' in readme .lower ()
61121
62122 def test_prepare_template_context (self , component_dir , sample_extracted_metadata ):
63123 """Test template context preparation."""
0 commit comments