Ejemplo n.º 1
0
    def test_departures_with_directions(self, response_with_directions):
        subject = DeparturesResponse(response_with_directions)
        assert len(subject.directions.keys()) == 2
        assert subject.directions["1"].__class__ == DirectionResponse
        direction = subject.directions["1"]

        assert direction.id == 1
        assert direction.name == "City (Flinders Street)"
        assert direction.route_id == 14
        assert direction.route_type == TRAIN
Ejemplo n.º 2
0
    def test_departures_with_routes(self, response_with_routes):
        subject = DeparturesResponse(response_with_routes)
        assert len(subject.routes.keys()) == 1
        assert subject.routes["14"].__class__ == RouteResponse
        route = subject.routes["14"]

        assert route.type == TRAIN
        assert route.id == 14
        assert route.name == "Sunbury"
        assert route.number == ""
        assert route.gtfs_id == "2-SYM"
Ejemplo n.º 3
0
    def test_departures_with_stops(self, response_with_stops):
        subject = DeparturesResponse(response_with_stops)
        assert len(subject.stops.keys()) == 1
        assert subject.stops["1196"].__class__ == StopByDistanceResponse
        stop = subject.stops["1196"]

        assert stop.distance == 0
        assert stop.suburb == "West Footscray"
        assert stop.name == "Tottenham"
        assert stop.id == 1196
        assert stop.route_type == TRAIN
        assert stop.latitude == -37.7992554
        assert stop.longitude == 144.862946
        assert stop.sequence == 0
Ejemplo n.º 4
0
    def test_departures_with_runs(self, response_with_runs):
        subject = DeparturesResponse(response_with_runs)
        assert len(subject.runs.keys()) == 1
        assert subject.runs["954708"].__class__ == RunResponse
        run = subject.runs["954708"]

        assert run.id == 954708
        assert run.route_id == 14
        assert run.route_type == TRAIN
        assert run.final_stop_id == 1071
        assert run.destination_name == "Flinders Street"
        assert run.status == "scheduled"
        assert run.direction_id == 1
        assert run.sequence == 0
        assert run.express_stop_count == 1
        assert run.vehicle_position == None
        assert run.vehicle_descriptor == None
Ejemplo n.º 5
0
    def test_departures_with_estimated_departure(self, response):
        subject = DeparturesResponse(response)
        assert len(subject.departures) == 2

        assert subject.departures[1].__class__ == DepartureResponse
        assert subject[1].__class__ == DepartureResponse
        departure = subject[1]

        assert departure.stop_id == 1196
        assert departure.route_id == 14
        assert departure.run_id == 954661
        assert departure.direction_id == 13
        assert departure.disruption_ids == []
        assert departure.scheduled_departure == datetime.datetime(2018, 8, 14, 14, 17, 00)
        assert departure.estimated_departure == datetime.datetime(2018, 8, 14, 15, 17, 00)
        assert departure.at_platform == False
        assert departure.platform_number == "2"
        assert departure.flags == ""
        assert departure.sequence == 0
Ejemplo n.º 6
0
    def test_departures_with_disruptions(self, response_with_disruptions):
        subject = DeparturesResponse(response_with_disruptions)
        assert len(subject.disruptions.keys()) == 1
        assert subject.disruptions["142498"].__class__ == DisruptionResponse
        disruption = subject.disruptions["142498"]

        assert disruption.id == 142498
        assert disruption.title == "Frankston line stations: Temporary car park closures and changes to pedestrian access until late-2018"
        assert disruption.url == "http://ptv.vic.gov.au/live-travel-updates/article/frankston-line-stations-temporary-car-park-closures-and-changes-to-pedestrian-access-until-late-2018"
        assert disruption.description == "There will be full and partial temporary long-term and short-term closures of station car parks and changes to pedestrian access in and around stations on the Frankston line, due to works as part of the Level Crossing Removal Project."
        assert disruption.status == "Current"
        assert disruption.type == "Planned Closure"
        assert disruption.published_on == datetime.datetime(2018, 7, 10, 1, 34, 18)
        assert disruption.last_updated == datetime.datetime(2018, 8, 13, 6, 26, 7)
        assert disruption.from_date == datetime.datetime(2018, 7, 10, 1, 16, 0)
        assert disruption.to_date == datetime.datetime(2018, 12, 30, 16, 0, 0)
        assert disruption.routes[0].type == TRAIN
        assert disruption.routes[0].id == 6
        assert disruption.routes[0].name == "Frankston"
        assert disruption.routes[0].number == ""
        assert disruption.routes[0].gtfs_id == "2-FKN"
        assert disruption.routes[0].direction == None
Ejemplo n.º 7
0
 def test_repr(self, response):
     subject = DeparturesResponse(response)
     assert subject.__repr__().__class__ == str
Ejemplo n.º 8
0
 def test_status(self, response):
     subject = DeparturesResponse(response)
     assert subject.status.__class__ == StatusResponse
     assert subject.status.version == "3.0"
     assert subject.status.health == ONLINE