@@ -705,6 +705,34 @@ def test_build_departure_and_arrival_poi_jo_add_forbidden_uris():
705
705
assert not api_request ["olympic_site_params" ]['show_natural_opg_journeys' ]
706
706
707
707
708
+ def test_build_departure_and_arrival_poi_jo_add_forbidden_uris_deactivate_opg_scenario ():
709
+ instance = FakeInstance (olympics_forbidden_uris = DEFAULT_OLYMPICS_FORBIDDEN_URIS )
710
+ osp = FakeOlympicSiteParamsManager (instance , DEFAULT_OLYMPIC_SITE_PARAMS_BUCKET )
711
+ osp .fill_olympic_site_params_from_s3 ()
712
+
713
+ pt_origin_detail = make_pt_object (type_pb2 .POI , 1 , 2 , "poi:EFG" )
714
+ property = pt_origin_detail .poi .properties .add ()
715
+ property .type = DEFAULT_OLYMPICS_FORBIDDEN_URIS ["poi_property_key" ]
716
+ property .value = DEFAULT_OLYMPICS_FORBIDDEN_URIS ["poi_property_value" ]
717
+
718
+ pt_destination_detail = make_pt_object (type_pb2 .POI , 2 , 3 , "poi:BCD" )
719
+ property = pt_destination_detail .poi .properties .add ()
720
+ property .type = DEFAULT_OLYMPICS_FORBIDDEN_URIS ["poi_property_key" ]
721
+ property .value = DEFAULT_OLYMPICS_FORBIDDEN_URIS ["poi_property_value" ]
722
+
723
+ api_request = {"forbidden_uris[]" : ["uri1" , "uri2" ]}
724
+
725
+ assert not api_request .get ("criteria" )
726
+ assert not api_request .get ("max_walking_duration_to_pt" )
727
+ assert "_keep_olympics_journeys" not in api_request
728
+ api_request ["datetime" ] = osp .get_timestamp ('20230715T110000' )
729
+ api_request ["_deactivate_opg_scenario" ] = True
730
+ osp .build (pt_origin_detail , pt_destination_detail , api_request )
731
+ assert "olympic_site_params" not in api_request
732
+ assert len (api_request ["forbidden_uris[]" ]) == 2
733
+ assert "_keep_olympics_journeys" not in api_request
734
+
735
+
708
736
def test_get_dict_scenario_invalid_scanario_name ():
709
737
instance = FakeInstance (olympics_forbidden_uris = DEFAULT_OLYMPICS_FORBIDDEN_URIS )
710
738
osp = FakeOlympicSiteParamsManager (instance , DEFAULT_OLYMPIC_SITE_PARAMS_BUCKET )
0 commit comments