1515import copy
1616
1717import pytest
18+ from psycopg2 .tz import FixedOffsetTimezone
1819from datedelta import datedelta
1920
2021from legal_api .models import Business
2425from tests .unit .models import factory_business
2526
2627FOUNDING_DATE = datetime (2023 , 3 , 3 )
27- IN_LIQUIDATION_DATE = datetime (2024 , 6 , 10 )
28+ IN_LIQUIDATION_DATE = datetime (2024 , 6 , 10 , 0 , 0 , tzinfo = FixedOffsetTimezone ( 0 ) )
2829
2930@pytest .mark .parametrize ('test_name, founding_date, in_liquidation_date, last_lr_year, expected_meta_data' , [
3031 ('NOT_IN_LIQUIDATION' , datetime .now (), None , None , {}),
3940 'inLiquidationDate' : IN_LIQUIDATION_DATE ,
4041 'lastLiquidationReportYear' : 2025 ,
4142 'nextLiquidationReportMinDate' : date (2026 , 3 , 2 )}
43+ ),
44+ # Should not happen, but need to make sure it still returns for this case
45+ ('IN_LIQUIDATION_no_in_liquidation_date' , FOUNDING_DATE , None , None ,
46+ {
47+ 'inLiquidationDate' : None ,
48+ 'lastLiquidationReportYear' : None ,
49+ 'nextLiquidationReportMinDate' : None }
4250 )
4351])
4452def test_check_business (session , test_name , founding_date , in_liquidation_date , last_lr_year , expected_meta_data ):
@@ -50,6 +58,10 @@ def test_check_business(session, test_name, founding_date, in_liquidation_date,
5058 in_liquidation_date = in_liquidation_date ,
5159 last_lr_year = last_lr_year )
5260
61+ if test_name != 'NOT_IN_LIQUIDATION' :
62+ business .in_liquidation = True
63+ business .save ()
64+
5365 result = check_business (business )
5466
5567 if test_name == 'NOT_IN_LIQUIDATION' :
0 commit comments