@@ -122,11 +122,18 @@ def test_handle_days_calculation(self, field_name, expected_days):
122122
123123 @patch ("apps.owasp.models.project_health_metrics.ProjectHealthMetrics.get_stats" )
124124 @patch ("reportlab.pdfgen.canvas.Canvas" )
125- @patch ("reportlab.platypus.tables.Table" )
126- @patch ("reportlab.platypus.tables.TableStyle" )
125+ @patch ("reportlab.platypus.Table" )
126+ @patch ("reportlab.platypus.TableStyle" )
127+ @patch ("reportlab.platypus.tables.Table.setStyle" )
127128 @patch ("io.BytesIO" )
128129 def test_generate_overview_pdf (
129- self , mock_bytes_io , mock_table_style , mock_table , mock_canvas , mock_get_stats
130+ self ,
131+ mock_bytes_io ,
132+ mock_set_style ,
133+ mock_table_style ,
134+ mock_table ,
135+ mock_canvas ,
136+ mock_get_stats ,
130137 ):
131138 """Test that the command executes without errors."""
132139 metrics_stats = ProjectHealthStatsNode (
@@ -167,7 +174,9 @@ def test_generate_overview_pdf(
167174 mock_bytes_io .assert_called_once ()
168175 mock_canvas .assert_called_once_with (mock_bytes_io .return_value )
169176 canvas = mock_canvas .return_value
170- mock_table .assert_called_once_with (table_data , colWidths = "*" )
177+ mock_table .assert_called_once_with (
178+ table_data , colWidths = "*" , style = mock_table_style .return_value
179+ )
171180 mock_table_style .assert_called_once ()
172181 mock_table .return_value .wrapOn .assert_called_once_with (canvas , 400 , 600 )
173182 mock_table .return_value .drawOn .assert_called_once_with (canvas , 100 , 570 )
0 commit comments