Skip to content

Commit 760d1ab

Browse files
committed
fix: Update tests to use public component API
Fix remaining test failures after exposing components publicly: tests/changelog/formatting/test_markdown_output.py: - test_markdown_section_data_generation: Use markdown_generator.get_markdown_section_data() - test_md_key_generation: Use markdown_generator.get_md_key() tests/changelog/conftest.py: - mock_diffstix fixture: Add mock hierarchy_builder component - complex_diffstix_with_all_changes fixture: Add mock markdown_generator and hierarchy_builder This fixes AttributeError issues where tests were calling removed facade methods or accessing components that weren't mocked.
1 parent 615941d commit 760d1ab

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

tests/changelog/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,11 @@ def mock_diffstix(diffstix_data):
682682
"unchanged": "Unchanged",
683683
}
684684

685+
# Add mock components for public API
686+
mock_hierarchy_builder = Mock()
687+
mock_hierarchy_builder.get_parent_stix_object.return_value = {}
688+
mock_diffstix.hierarchy_builder = mock_hierarchy_builder
689+
685690
return mock_diffstix
686691

687692

@@ -1133,6 +1138,15 @@ def complex_diffstix_with_all_changes(diffstix_data, mock_stix_object_factory):
11331138
"unchanged": "Unchanged",
11341139
}
11351140

1141+
# Add mock components for public API
1142+
mock_markdown_generator = Mock()
1143+
mock_markdown_generator.get_md_key.return_value = "## Key\nTest key content"
1144+
mock_diffstix.markdown_generator = mock_markdown_generator
1145+
1146+
mock_hierarchy_builder = Mock()
1147+
mock_hierarchy_builder.get_parent_stix_object.return_value = {}
1148+
mock_diffstix.hierarchy_builder = mock_hierarchy_builder
1149+
11361150
return mock_diffstix
11371151

11381152

tests/changelog/formatting/test_markdown_output.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_markdown_section_data_generation(self, lightweight_diffstix, sample_tec
9393
]
9494

9595
# Test real markdown section generation
96-
result = lightweight_diffstix.get_markdown_section_data(
96+
result = lightweight_diffstix.markdown_generator.get_markdown_section_data(
9797
groupings=test_groupings, section="additions", domain="enterprise-attack"
9898
)
9999

@@ -124,7 +124,7 @@ def test_contributor_section_generation(self, lightweight_diffstix):
124124

125125
def test_md_key_generation(self, lightweight_diffstix):
126126
"""Test real markdown key generation."""
127-
result = lightweight_diffstix.get_md_key()
127+
result = lightweight_diffstix.markdown_generator.get_md_key()
128128

129129
# Verify real key content
130130
assert isinstance(result, str)

0 commit comments

Comments
 (0)