@@ -1191,6 +1191,46 @@ def test_special_resolution_drs_report_type(session, filing_type, expected_repor
11911191 assert response .status_code == HTTPStatus .OK
11921192
11931193
1194+ @pytest .mark .parametrize ('filing_type,report_key,expected_report_type' , [
1195+ ('annualReport' , 'annualReport' , 'FILING' ),
1196+ ('annualReport' , 'changeOfDirectors' , 'FILING-2' ),
1197+ ('annualReport' , 'changeOfAddress' , 'FILING-4' ),
1198+ ('changeOfDirectors' , 'changeOfDirectors' , 'FILING' ),
1199+ ('changeOfAddress' , 'changeOfAddress' , 'FILING' ),
1200+ ])
1201+ def test_coop_annual_report_drs_report_types (session , filing_type , report_key , expected_report_type ):
1202+ """Assert each legal filing bundled in a coop annual report uses a distinct DRS report type (#34457).
1203+
1204+ When stored with the same FILING report type as the annual report's own output, the DRS-first
1205+ lookup serves whichever of the documents was stored first, so every output shows the same content.
1206+ """
1207+ identifier = 'CP1234567'
1208+ business = factory_business (identifier = identifier , entity_type = 'CP' )
1209+
1210+ filing_json = copy .deepcopy (FILING_HEADER )
1211+ filing_json ['filing' ]['header' ]['name' ] = filing_type
1212+ filing_json ['filing' ]['business' ]['identifier' ] = identifier
1213+ filing_json ['filing' ]['business' ]['legalType' ] = 'CP'
1214+ if filing_type == 'annualReport' :
1215+ filing_json ['filing' ]['annualReport' ] = copy .deepcopy (ANNUAL_REPORT ['filing' ]['annualReport' ])
1216+ if report_key == 'changeOfDirectors' :
1217+ filing_json ['filing' ]['changeOfDirectors' ] = copy .deepcopy (CHANGE_OF_DIRECTORS )
1218+ if report_key == 'changeOfAddress' :
1219+ filing_json ['filing' ]['changeOfAddress' ] = copy .deepcopy (CHANGE_OF_ADDRESS )
1220+ filing = factory_completed_filing (business , filing_json )
1221+
1222+ report = Report (filing )
1223+ report ._report_key = report_key
1224+ report ._document_service = MagicMock ()
1225+ report ._document_service .get_filing_report_by_filing_id .return_value = (b'pdf' , HTTPStatus .OK )
1226+
1227+ response = report ._get_report ()
1228+
1229+ report ._document_service .get_filing_report_by_filing_id .assert_called_once_with (
1230+ identifier , filing .id , expected_report_type )
1231+ assert response .status_code == HTTPStatus .OK
1232+
1233+
11941234def _make_static_report_filing (identifier , document_type , file_key ):
11951235 """Create a completed coop dissolution filing with an uploaded document row."""
11961236 from business_model .models import Document
0 commit comments