@@ -520,7 +520,7 @@ def fill_best_boarding_position_test():
520
520
assert response_pb2 .BoardingPosition .BACK not in journey .sections [0 ].best_boarding_positions
521
521
522
522
523
- def get_response_with_a_disruption_on_poi ():
523
+ def get_response_with_a_disruption_on_poi (uri = "poi_uri" , name = "poi_name_from_loki" ):
524
524
start_period = "20240712T165200"
525
525
end_period = "20240812T165200"
526
526
response = response_pb2 .Response ()
@@ -531,8 +531,8 @@ def get_response_with_a_disruption_on_poi():
531
531
532
532
# poi = make_pt_object(type_pb2.POI, lon=1, lat=2, uri='poi:test_uri')
533
533
# impacted_object.pt_object.CopyFrom(poi)
534
- impacted_object .pt_object .name = "poi_name_from_loki"
535
- impacted_object .pt_object .uri = "poi_uri"
534
+ impacted_object .pt_object .name = name
535
+ impacted_object .pt_object .uri = uri
536
536
impacted_object .pt_object .embedded_type = type_pb2 .POI
537
537
impact .updated_at = utils .str_to_time_stamp (u'20240712T205200' )
538
538
application_period = impact .application_periods .add ()
@@ -623,6 +623,79 @@ def get_journey_with_pois():
623
623
return response
624
624
625
625
626
+ def get_pb_response_with_journeys_and_disruptions ():
627
+ response = response_pb2 .Response ()
628
+
629
+ # Add a journey : walking address to stop_point + PT stop_point to stop_point + walking toward address
630
+ journey = response .journeys .add ()
631
+ section = journey .sections .add ()
632
+ section .type = response_pb2 .STREET_NETWORK
633
+ section .street_network .mode = response_pb2 .Walking
634
+ section .origin .uri = 'address_a'
635
+ section .origin .embedded_type = type_pb2 .ADDRESS
636
+ section .destination .uri = 'stop_point_a'
637
+ section .destination .embedded_type = type_pb2 .STOP_POINT
638
+ section .destination .stop_point .uri = 'stop_point_a'
639
+ section .destination .stop_point .name = 'stop_point_name_a'
640
+ section .destination .stop_point .coord .lon = 1.0
641
+ section .destination .stop_point .coord .lat = 2.0
642
+
643
+ section = journey .sections .add ()
644
+ section .type = response_pb2 .PUBLIC_TRANSPORT
645
+ section .origin .uri = 'stop_point_a'
646
+ section .origin .embedded_type = type_pb2 .STOP_POINT
647
+ section .origin .stop_point .uri = 'stop_point_a'
648
+ section .origin .stop_point .name = 'stop_point_name_a'
649
+ section .origin .stop_point .coord .lon = 1.0
650
+ section .origin .stop_point .coord .lat = 2.0
651
+ section .destination .uri = 'stop_point_b'
652
+ section .destination .embedded_type = type_pb2 .STOP_POINT
653
+ section .destination .stop_point .uri = 'stop_point_b'
654
+ section .destination .stop_point .name = 'stop_point_name_b'
655
+ section .destination .stop_point .coord .lon = 3.0
656
+ section .destination .stop_point .coord .lat = 4.0
657
+
658
+ section = journey .sections .add ()
659
+ section .type = response_pb2 .STREET_NETWORK
660
+ section .street_network .mode = response_pb2 .Walking
661
+ section .origin .uri = 'stop_point_b'
662
+ section .origin .embedded_type = type_pb2 .STOP_POINT
663
+ section .origin .stop_point .uri = 'stop_point_b'
664
+ section .origin .stop_point .name = 'stop_point_name_b'
665
+ section .origin .stop_point .coord .lon = 3.0
666
+ section .origin .stop_point .coord .lat = 4.0
667
+ section .destination .uri = 'address_b'
668
+ section .destination .embedded_type = type_pb2 .ADDRESS
669
+
670
+ # Add a journey : walking address to address
671
+ journey = response .journeys .add ()
672
+ section = journey .sections .add ()
673
+ section .type = response_pb2 .STREET_NETWORK
674
+ section .street_network .mode = response_pb2 .Walking
675
+ section .origin .uri = 'address_a'
676
+ section .origin .embedded_type = type_pb2 .ADDRESS
677
+ section .destination .uri = 'address_b'
678
+ section .destination .embedded_type = type_pb2 .ADDRESS
679
+
680
+ # Add disruption on poi 'poi_uri_a':
681
+ pb_disruptions = get_response_with_a_disruption_on_poi (uri = "poi_uri_a" , name = "poi_name_a" )
682
+ response .impacts .extend (pb_disruptions .impacts )
683
+ response .status_code = 200
684
+ return response
685
+
686
+
687
+ def get_json_entry_point (id = "poi_uri" , name = "poi_name_from_kraken" ):
688
+ entry_point = {}
689
+ entry_point ['id' ] = id
690
+ entry_point ['name' ] = name
691
+ entry_point ['embedded_type' ] = "poi"
692
+ object = {}
693
+ object ['id' ] = id
694
+ object ['name' ] = name
695
+ entry_point ['poi' ] = object
696
+ return entry_point
697
+
698
+
626
699
def verify_poi_in_impacted_objects (object , poi_empty = True ):
627
700
assert object .name == "poi_name_from_loki"
628
701
assert object .uri == "poi_uri"
0 commit comments