@@ -116,6 +116,38 @@ def test_get_tasks_sentinel_founding_date_skips_ar(session, client, jwt):
116116 assert len (ar_tasks ) == 0
117117
118118
119+ @pytest .mark .parametrize ('test_name, legal_type' , [
120+ ('railways' , Business .LegalTypes .RAILWAYS .value ),
121+ ('library' , Business .LegalTypes .LIBRARY .value ),
122+ ('cemetery' , Business .LegalTypes .CEMETARY .value ),
123+ ('tramways' , Business .LegalTypes .TRAMWAYS .value ),
124+ ('pension_funded_society' , Business .LegalTypes .PENS_FUND_SOC .value ),
125+ ('society_branch' , Business .LegalTypes .SOCIETY_BRANCH .value ),
126+ ])
127+ def test_get_tasks_legacy_migrated_types_no_ar (session , client , jwt , test_name , legal_type ):
128+ """Assert legacy/mainframe-migrated legal types never get AR todos, even with a real old founding date.
129+
130+ These legal types don't support annualReport filing (see ANNUAL_REPORT_LEGAL_TYPES in authz.py), so
131+ filing is greyed out in the UI regardless. Businesses founded decades ago (e.g. 1940) should not
132+ generate a huge backlog of AR todos that can never actually be filed.
133+ """
134+ identifier = 'BC1234567'
135+ factory_business (
136+ identifier ,
137+ founding_date = datetime (1940 , 1 , 1 , tzinfo = UTC ),
138+ entity_type = legal_type ,
139+ state = Business .State .ACTIVE ,
140+ )
141+
142+ rv = client .get (f'/api/v2/businesses/{ identifier } /tasks' , headers = create_header (jwt , [STAFF_ROLE ], identifier ))
143+ assert rv .status_code == HTTPStatus .OK
144+ ar_tasks = [
145+ t for t in rv .json .get ('tasks' )
146+ if t .get ('task' , {}).get ('todo' , {}).get ('header' , {}).get ('name' ) == 'annualReport'
147+ ]
148+ assert len (ar_tasks ) == 0
149+
150+
119151def test_get_tasks_next_year (session , client , jwt ):
120152 """Assert that one todo item is returned in the calendar year following incorporation."""
121153 identifier = 'CP7654321'
0 commit comments