Coverage for app/tests/delivery_fee/test_fee_calculator_initialization.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.4.1, created at 2024-11-27 09:26 +0000

1from app.delivery_fee.settings import ALL_CALCULATION_STEPS 

2from app.delivery_fee.settings import ALL_FEE_TRANSFORMERS 

3from app.delivery_fee.fee_calculator import DeliveryFeeCalculator 

4 

5 

6def test__initialize_delivery_fee_calculator_with_default_params(): 

7 delivery_fee_calculator = DeliveryFeeCalculator() 

8 assert delivery_fee_calculator.calculation_steps == ALL_CALCULATION_STEPS 

9 assert delivery_fee_calculator.transformers == ALL_FEE_TRANSFORMERS 

10 

11 

12def test__initialize_delivery_fee_calculator_with_None(): 

13 delivery_fee_calculator = DeliveryFeeCalculator(None, None) 

14 assert delivery_fee_calculator.calculation_steps == ALL_CALCULATION_STEPS 

15 assert delivery_fee_calculator.transformers == ALL_FEE_TRANSFORMERS 

16 

17 

18def test__initialization_delivery_fee_with_params(): 

19 DeliveryFeeCalculator.clear_singleton_instance() 

20 calc_steps = [ALL_CALCULATION_STEPS[0]] 

21 transformers = [ALL_FEE_TRANSFORMERS[0]] 

22 delivery_fee_calculator = DeliveryFeeCalculator( 

23 calculation_steps=calc_steps, transformers=transformers) 

24 assert delivery_fee_calculator.calculation_steps == calc_steps 

25 assert delivery_fee_calculator.transformers == transformers