1597 lines
56 KiB
Python
1597 lines
56 KiB
Python
# -*- coding: utf-8 -*-
|
||
import pytest
|
||
import mock
|
||
import utils
|
||
|
||
from django.contrib.contenttypes.models import ContentType
|
||
|
||
from passerelle.apps.okina.models import Okina
|
||
from passerelle.base.models import ApiUser, AccessRight
|
||
|
||
|
||
CITIES = '''[ {
|
||
"city" : 83355,
|
||
"cityObject" : {
|
||
"id" : 83355,
|
||
"insee" : "36005",
|
||
"nameCity" : "ARDENTES",
|
||
"zipCode" : "36120",
|
||
"nameCityRouting" : "ARDENTES",
|
||
"line5" : null
|
||
}
|
||
}, {
|
||
"city" : 80237,
|
||
"cityObject" : {
|
||
"id" : 80237,
|
||
"insee" : "36044",
|
||
"nameCity" : "CHATEAUROUX",
|
||
"zipCode" : "36000",
|
||
"nameCityRouting" : "CHATEAUROUX",
|
||
"line5" : null
|
||
}
|
||
} ]
|
||
|
||
'''
|
||
|
||
CLASSES = '''
|
||
[
|
||
{
|
||
"id": 1,
|
||
"label": "École maternelle - Petite section"
|
||
},
|
||
{
|
||
"id": 2,
|
||
"label": "École maternelle - Moyenne section"
|
||
},
|
||
{
|
||
"id": 4,
|
||
"label": "École élémentaire – CP"
|
||
},
|
||
{
|
||
"id": 5,
|
||
"label": "École élémentaire – CE 1"
|
||
}
|
||
]
|
||
'''
|
||
|
||
INSTITUTIONS = '''[ {
|
||
"id" : 276,
|
||
"schoolEstablishment" : {
|
||
"uai" : "0360155Y",
|
||
"uaiLabel" : "Ecole élémentaire Saint-Martin",
|
||
"mainTitle" : "ECOLE ELEMENTAIRE PUBLIQUE",
|
||
"type" : "Public",
|
||
"address" : "RUE CALMETTE ET GUERIN",
|
||
"zipCode" : "36120",
|
||
"cityName" : "ARDENTES",
|
||
"locationX" : "1.82965415466176",
|
||
"locationY" : "46.740247926141706",
|
||
"nature" : "151",
|
||
"natureTitle" : "Ecole élémentaire"
|
||
},
|
||
"schoolEstablishmentUai" : "0360155Y",
|
||
"zipAndCity" : "36120 - ARDENTES",
|
||
"institutionContacts" : [ ]
|
||
}, {
|
||
"id" : 277,
|
||
"schoolEstablishment" : {
|
||
"uai" : "0360048G",
|
||
"uaiLabel" : "Collège Touvent",
|
||
"mainTitle" : "COLLEGE",
|
||
"type" : "Public",
|
||
"address" : "4 ALLÉE DES LAURIERS",
|
||
"zipCode" : "36007",
|
||
"cityName" : "CHATEAUROUX CEDEX",
|
||
"locationX" : "1.692635599708531",
|
||
"locationY" : "46.791332546947025",
|
||
"nature" : "340",
|
||
"natureTitle" : "Collège"
|
||
},
|
||
"schoolEstablishmentUai" : "0360048G",
|
||
"zipAndCity" : "36007 - CHATEAUROUX CEDEX",
|
||
"institutionContacts" : [ ]
|
||
} ]
|
||
|
||
'''
|
||
|
||
STOPS = '''
|
||
[ {
|
||
"id" : 3281,
|
||
"stop_point_id" : 827,
|
||
"name" : "Les Loges de Dressais",
|
||
"latitude" : 46.7317874000000018,
|
||
"longitude" : 1.7887462999999999,
|
||
"bearing" : 0.0,
|
||
"position" : 2,
|
||
"commercial_stop_area" : 3281,
|
||
"commercial_name" : "Les Loges de Dressais",
|
||
"liaisons" : [ ],
|
||
"registrationNumber" : null
|
||
}, {
|
||
"id" : 3279,
|
||
"stop_point_id" : 828,
|
||
"name" : "La Cueille",
|
||
"latitude" : 46.7500219000000001,
|
||
"longitude" : 1.7890467000000001,
|
||
"bearing" : 0.0,
|
||
"position" : 3,
|
||
"commercial_stop_area" : 3279,
|
||
"commercial_name" : "La Cueille",
|
||
"liaisons" : [ ],
|
||
"registrationNumber" : null
|
||
}, {
|
||
"id" : 3560,
|
||
"stop_point_id" : 869,
|
||
"name" : "Ecole Primaire SAINT-VINCENT",
|
||
"latitude" : 46.7423843999999988,
|
||
"longitude" : 1.83196010000000009,
|
||
"bearing" : 0.0,
|
||
"position" : 3,
|
||
"commercial_stop_area" : 3560,
|
||
"commercial_name" : "Ecole Primaire SAINT-VINCENT",
|
||
"liaisons" : [ ],
|
||
"registrationNumber" : null
|
||
} ]
|
||
|
||
'''
|
||
|
||
# https://iti.okina.fr/api/Okina/REST/b2b/ods
|
||
ODS = '''[ {
|
||
"id" : {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 1
|
||
},
|
||
"institution" : {
|
||
"id" : 276,
|
||
"schoolEstablishmentUai" : "0360155Y",
|
||
"okinaStopAreas" : null
|
||
},
|
||
"originDestinationSequenceElements" : [ {
|
||
"id" : 6,
|
||
"okinaVehicleJourney" : {
|
||
"detached" : false,
|
||
"objectId" : "Europe Voyages 23:VehicleJourney:84",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491516000000,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"id" : 84,
|
||
"comment" : null,
|
||
"transportMode" : null,
|
||
"publishedJourneyName" : "SYNDICAT ARDENTES 4 (semaine Aller)",
|
||
"publishedJourneyIdentifier" : "SYNDICAT ARDENTES 4 (semaine Aller)",
|
||
"facility" : null,
|
||
"vehicleTypeIdentifier" : null,
|
||
"number" : 84,
|
||
"mobilityRestrictedSuitability" : null,
|
||
"flexibleService" : null,
|
||
"route" : null,
|
||
"journeyPattern" : null,
|
||
"company" : null,
|
||
"footnotes" : null,
|
||
"timetables" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"journeyCategory" : "Timesheet",
|
||
"journeyFrequencies" : null,
|
||
"okinaJourneyPattern" : null,
|
||
"okinaRoute" : null,
|
||
"etat" : 0,
|
||
"supprime" : false,
|
||
"okinaVehicleJourneyAtStops" : null,
|
||
"counterGroups" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
},
|
||
"okinaJourneyPattern" : null,
|
||
"position" : 1,
|
||
"originDestination" : {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 1
|
||
}
|
||
} ],
|
||
"oppositeOds" : null,
|
||
"way" : "WAY_TO"
|
||
}, {
|
||
"id" : {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 2
|
||
},
|
||
"institution" : {
|
||
"id" : 276,
|
||
"schoolEstablishmentUai" : "0360155Y",
|
||
"okinaStopAreas" : null
|
||
},
|
||
"originDestinationSequenceElements" : [ {
|
||
"id" : 203,
|
||
"okinaVehicleJourney" : {
|
||
"detached" : false,
|
||
"objectId" : "STI CENTRE:VehicleJourney:90",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491516000000,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"id" : 90,
|
||
"comment" : null,
|
||
"transportMode" : null,
|
||
"publishedJourneyName" : "SYNDICAT ARDENTES 6 (semaine Aller)",
|
||
"publishedJourneyIdentifier" : "SYNDICAT ARDENTES 6 (semaine Aller)",
|
||
"facility" : null,
|
||
"vehicleTypeIdentifier" : null,
|
||
"number" : 90,
|
||
"mobilityRestrictedSuitability" : null,
|
||
"flexibleService" : null,
|
||
"route" : null,
|
||
"journeyPattern" : null,
|
||
"company" : null,
|
||
"footnotes" : null,
|
||
"timetables" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"journeyCategory" : "Timesheet",
|
||
"journeyFrequencies" : null,
|
||
"okinaJourneyPattern" : null,
|
||
"okinaRoute" : null,
|
||
"etat" : 0,
|
||
"supprime" : false,
|
||
"okinaVehicleJourneyAtStops" : null,
|
||
"counterGroups" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
},
|
||
"okinaJourneyPattern" : null,
|
||
"position" : 1,
|
||
"originDestination" : {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 2
|
||
}
|
||
} ],
|
||
"oppositeOds" : null,
|
||
"way" : "WAY_TO"
|
||
} ]
|
||
|
||
'''
|
||
|
||
# https://iti.okina.fr/api/Okina/REST/b2b/ods/institution/276/stop-area/3282
|
||
ODS_LINES = '''[ [ { "id" : 24, "name" : "LIGNE 24" } ],
|
||
[ { "id": 22,"name": "LIGNE 22" } ],
|
||
[ { "id": 24, "name" : "LIGNE 24" }, { "id": 23, "name": "LIGNE 23" } ] ]
|
||
|
||
'''
|
||
|
||
# https://iti.okina.fr/api/Okina/REST/b2b/ods/institution/276/subscriberCity/36005
|
||
# https://iti.okina.fr/api/Okina/REST/b2b/ods/subscriberCity/36005
|
||
ODS_FULL = '''[ {
|
||
"id" : {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 1
|
||
},
|
||
"institution" : {
|
||
"id" : 276,
|
||
"schoolEstablishmentUai" : "0360155Y",
|
||
"okinaStopAreas" : null
|
||
},
|
||
"originDestinationSequenceElements" : [ {
|
||
"id" : 6,
|
||
"okinaVehicleJourney" : {
|
||
"detached" : false,
|
||
"objectId" : "Europe Voyages 23:VehicleJourney:84",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491516000000,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"id" : 84,
|
||
"comment" : null,
|
||
"transportMode" : null,
|
||
"publishedJourneyName" : "SYNDICAT ARDENTES 4 (semaine Aller)",
|
||
"publishedJourneyIdentifier" : "SYNDICAT ARDENTES 4 (semaine Aller)",
|
||
"facility" : null,
|
||
"vehicleTypeIdentifier" : null,
|
||
"number" : 84,
|
||
"mobilityRestrictedSuitability" : null,
|
||
"flexibleService" : null,
|
||
"route" : null,
|
||
"journeyPattern" : null,
|
||
"company" : null,
|
||
"footnotes" : null,
|
||
"timetables" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"journeyCategory" : "Timesheet",
|
||
"journeyFrequencies" : null,
|
||
"okinaJourneyPattern" : {
|
||
"detached" : false,
|
||
"objectId" : "europevoyages:JourneyPattern:86",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491516000000,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"id" : 86,
|
||
"name" : "Brenne 1 vers écoles Antoine Fée, Saint Martin et Saint Vincent (semaine Aller)",
|
||
"comment" : null,
|
||
"registrationNumber" : null,
|
||
"publishedName" : "Brenne 1 vers écoles Antoine Fée, Saint Martin et Saint Vincent",
|
||
"sectionStatus" : "Todo",
|
||
"route" : null,
|
||
"departureStopPoint" : null,
|
||
"arrivalStopPoint" : null,
|
||
"stopPoints" : null,
|
||
"vehicleJourneys" : null,
|
||
"routeSections" : null,
|
||
"okinaStopPoints" : [ {
|
||
"id" : 825,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:825",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491551801241,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 0,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : {
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopArea:Boarding_36005_004",
|
||
"objectVersion" : 1,
|
||
"creationTime" : null,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"longitude" : 1.81673930000000006,
|
||
"latitude" : 46.719458699999997,
|
||
"longLatType" : null,
|
||
"x" : null,
|
||
"y" : null,
|
||
"projectionType" : null,
|
||
"countryCode" : "36005",
|
||
"zipCode" : "36120",
|
||
"cityName" : "Ardentes",
|
||
"streetName" : null,
|
||
"id" : 3273,
|
||
"name" : "Brenne 1",
|
||
"comment" : null,
|
||
"areaType" : "BoardingPosition",
|
||
"registrationNumber" : "36005_004",
|
||
"nearestTopicName" : null,
|
||
"url" : null,
|
||
"timeZone" : null,
|
||
"fareCode" : null,
|
||
"liftAvailable" : null,
|
||
"mobilityRestrictedSuitable" : null,
|
||
"stairsAvailable" : null,
|
||
"intUserNeeds" : null,
|
||
"parent" : null,
|
||
"routingConstraintLines" : null,
|
||
"routingConstraintAreas" : null,
|
||
"containedStopAreas" : null,
|
||
"containedStopPoints" : null,
|
||
"accessLinks" : null,
|
||
"routeSectionDepartures" : null,
|
||
"routeSectionArrivals" : null,
|
||
"connectionStartLinks" : null,
|
||
"connectionEndLinks" : null,
|
||
"accessPoints" : null,
|
||
"okinaContainedStopPoints" : null,
|
||
"okinaParent" : null,
|
||
"bearing" : 0.0,
|
||
"cityCode" : "36005",
|
||
"okinaContainedStopAreas" : null,
|
||
"userNeeds" : [ ],
|
||
"filled" : false
|
||
},
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 826,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:826",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491551801241,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 1,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : {
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopArea:Boarding_36005_005",
|
||
"objectVersion" : 1,
|
||
"creationTime" : null,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"longitude" : 1.80696429999999997,
|
||
"latitude" : 46.7233643000000001,
|
||
"longLatType" : null,
|
||
"x" : null,
|
||
"y" : null,
|
||
"projectionType" : null,
|
||
"countryCode" : "36005",
|
||
"zipCode" : "36120",
|
||
"cityName" : "Ardentes",
|
||
"streetName" : null,
|
||
"id" : 3274,
|
||
"name" : "Brenne 2",
|
||
"comment" : null,
|
||
"areaType" : "BoardingPosition",
|
||
"registrationNumber" : "36005_005",
|
||
"nearestTopicName" : null,
|
||
"url" : null,
|
||
"timeZone" : null,
|
||
"fareCode" : null,
|
||
"liftAvailable" : null,
|
||
"mobilityRestrictedSuitable" : null,
|
||
"stairsAvailable" : null,
|
||
"intUserNeeds" : null,
|
||
"parent" : null,
|
||
"routingConstraintLines" : null,
|
||
"routingConstraintAreas" : null,
|
||
"containedStopAreas" : null,
|
||
"containedStopPoints" : null,
|
||
"accessLinks" : null,
|
||
"routeSectionDepartures" : null,
|
||
"routeSectionArrivals" : null,
|
||
"connectionStartLinks" : null,
|
||
"connectionEndLinks" : null,
|
||
"accessPoints" : null,
|
||
"okinaContainedStopPoints" : null,
|
||
"okinaParent" : null,
|
||
"bearing" : 0.0,
|
||
"cityCode" : "36005",
|
||
"okinaContainedStopAreas" : null,
|
||
"userNeeds" : [ ],
|
||
"filled" : false
|
||
},
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 827,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:827",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491551801242,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 2,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : {
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopArea:Boarding_36005_012",
|
||
"objectVersion" : 1,
|
||
"creationTime" : null,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"longitude" : 1.7887462999999999,
|
||
"latitude" : 46.7317874000000018,
|
||
"longLatType" : null,
|
||
"x" : null,
|
||
"y" : null,
|
||
"projectionType" : null,
|
||
"countryCode" : "36005",
|
||
"zipCode" : "36120",
|
||
"cityName" : "Ardentes",
|
||
"streetName" : null,
|
||
"id" : 3281,
|
||
"name" : "Les Loges de Dressais",
|
||
"comment" : null,
|
||
"areaType" : "BoardingPosition",
|
||
"registrationNumber" : "36005_012",
|
||
"nearestTopicName" : null,
|
||
"url" : null,
|
||
"timeZone" : null,
|
||
"fareCode" : null,
|
||
"liftAvailable" : null,
|
||
"mobilityRestrictedSuitable" : null,
|
||
"stairsAvailable" : null,
|
||
"intUserNeeds" : null,
|
||
"parent" : null,
|
||
"routingConstraintLines" : null,
|
||
"routingConstraintAreas" : null,
|
||
"containedStopAreas" : null,
|
||
"containedStopPoints" : null,
|
||
"accessLinks" : null,
|
||
"routeSectionDepartures" : null,
|
||
"routeSectionArrivals" : null,
|
||
"connectionStartLinks" : null,
|
||
"connectionEndLinks" : null,
|
||
"accessPoints" : null,
|
||
"okinaContainedStopPoints" : null,
|
||
"okinaParent" : null,
|
||
"bearing" : 0.0,
|
||
"cityCode" : "36005",
|
||
"okinaContainedStopAreas" : null,
|
||
"userNeeds" : [ ],
|
||
"filled" : false
|
||
},
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 828,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:828",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491551801242,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 3,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : {
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopArea:Boarding_36005_010",
|
||
"objectVersion" : 1,
|
||
"creationTime" : null,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"longitude" : 1.7890467000000001,
|
||
"latitude" : 46.7500219000000001,
|
||
"longLatType" : null,
|
||
"x" : null,
|
||
"y" : null,
|
||
"projectionType" : null,
|
||
"countryCode" : "36005",
|
||
"zipCode" : "36120",
|
||
"cityName" : "Ardentes",
|
||
"streetName" : null,
|
||
"id" : 3279,
|
||
"name" : "La Cueille",
|
||
"comment" : null,
|
||
"areaType" : "BoardingPosition",
|
||
"registrationNumber" : "36005_010",
|
||
"nearestTopicName" : null,
|
||
"url" : null,
|
||
"timeZone" : null,
|
||
"fareCode" : null,
|
||
"liftAvailable" : null,
|
||
"mobilityRestrictedSuitable" : null,
|
||
"stairsAvailable" : null,
|
||
"intUserNeeds" : null,
|
||
"parent" : null,
|
||
"routingConstraintLines" : null,
|
||
"routingConstraintAreas" : null,
|
||
"containedStopAreas" : null,
|
||
"containedStopPoints" : null,
|
||
"accessLinks" : null,
|
||
"routeSectionDepartures" : null,
|
||
"routeSectionArrivals" : null,
|
||
"connectionStartLinks" : null,
|
||
"connectionEndLinks" : null,
|
||
"accessPoints" : null,
|
||
"okinaContainedStopPoints" : null,
|
||
"okinaParent" : null,
|
||
"bearing" : 0.0,
|
||
"cityCode" : "36005",
|
||
"okinaContainedStopAreas" : null,
|
||
"userNeeds" : [ ],
|
||
"filled" : false
|
||
},
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 829,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:829",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491551801242,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 4,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : {
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopArea:Boarding_36005_013",
|
||
"objectVersion" : 1,
|
||
"creationTime" : null,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"longitude" : 1.79444730000000008,
|
||
"latitude" : 46.7477992999999969,
|
||
"longLatType" : null,
|
||
"x" : null,
|
||
"y" : null,
|
||
"projectionType" : null,
|
||
"countryCode" : "36005",
|
||
"zipCode" : "36120",
|
||
"cityName" : "Ardentes",
|
||
"streetName" : null,
|
||
"id" : 3282,
|
||
"name" : "Les Loges du Plessis",
|
||
"comment" : null,
|
||
"areaType" : "BoardingPosition",
|
||
"registrationNumber" : "36005_013",
|
||
"nearestTopicName" : null,
|
||
"url" : null,
|
||
"timeZone" : null,
|
||
"fareCode" : null,
|
||
"liftAvailable" : null,
|
||
"mobilityRestrictedSuitable" : null,
|
||
"stairsAvailable" : null,
|
||
"intUserNeeds" : null,
|
||
"parent" : null,
|
||
"routingConstraintLines" : null,
|
||
"routingConstraintAreas" : null,
|
||
"containedStopAreas" : null,
|
||
"containedStopPoints" : null,
|
||
"accessLinks" : null,
|
||
"routeSectionDepartures" : null,
|
||
"routeSectionArrivals" : null,
|
||
"connectionStartLinks" : null,
|
||
"connectionEndLinks" : null,
|
||
"accessPoints" : null,
|
||
"okinaContainedStopPoints" : null,
|
||
"okinaParent" : null,
|
||
"bearing" : 0.0,
|
||
"cityCode" : "36005",
|
||
"okinaContainedStopAreas" : null,
|
||
"userNeeds" : [ ],
|
||
"filled" : false
|
||
},
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 830,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:830",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491551801243,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 5,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 831,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:831",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491551801243,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 6,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 832,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:832",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491551801244,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 7,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
} ],
|
||
"okinaVehicleJourneys" : null,
|
||
"etat" : 0,
|
||
"supprime" : false,
|
||
"okinaRoute" : null,
|
||
"okinaDepartureStopPoint" : null,
|
||
"okinaArrivalStopPoint" : null,
|
||
"filled" : false
|
||
},
|
||
"okinaRoute" : null,
|
||
"etat" : 0,
|
||
"supprime" : false,
|
||
"okinaVehicleJourneyAtStops" : null,
|
||
"counterGroups" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
},
|
||
"okinaJourneyPattern" : null,
|
||
"position" : 1,
|
||
"originDestination" : {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 1
|
||
}
|
||
} ],
|
||
"oppositeOds" : [ {
|
||
"id" : {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 3
|
||
},
|
||
"institution" : {
|
||
"id" : 276,
|
||
"schoolEstablishmentUai" : "0360155Y",
|
||
"okinaStopAreas" : null
|
||
},
|
||
"originDestinationSequenceElements" : [ {
|
||
"id" : 3,
|
||
"okinaVehicleJourney" : {
|
||
"detached" : false,
|
||
"objectId" : "Europe Voyages 23:VehicleJourney:86",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491516000000,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"id" : 86,
|
||
"comment" : null,
|
||
"transportMode" : null,
|
||
"publishedJourneyName" : "SYNDICAT ARDENTES 4 (mercredi Retour)",
|
||
"publishedJourneyIdentifier" : "SYNDICAT ARDENTES 4 (mercredi Retour)",
|
||
"facility" : null,
|
||
"vehicleTypeIdentifier" : null,
|
||
"number" : 86,
|
||
"mobilityRestrictedSuitability" : null,
|
||
"flexibleService" : null,
|
||
"route" : null,
|
||
"journeyPattern" : null,
|
||
"company" : null,
|
||
"footnotes" : null,
|
||
"timetables" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"journeyCategory" : "Timesheet",
|
||
"journeyFrequencies" : null,
|
||
"okinaJourneyPattern" : {
|
||
"detached" : false,
|
||
"objectId" : "europevoyages:JourneyPattern:89",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491516000000,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"id" : 89,
|
||
"name" : "écoles St Vincent, Antoine Fée et St Martin vers Brenne 1 (mercredi Retour) 2017-04-07 10:10:43.949",
|
||
"comment" : null,
|
||
"registrationNumber" : null,
|
||
"publishedName" : "écoles St Vincent, Antoine Fée et St Martin vers Brenne 1 2017-04-07 10:10:43.949",
|
||
"sectionStatus" : "Todo",
|
||
"route" : null,
|
||
"departureStopPoint" : null,
|
||
"arrivalStopPoint" : null,
|
||
"stopPoints" : null,
|
||
"vehicleJourneys" : null,
|
||
"routeSections" : null,
|
||
"okinaStopPoints" : [ {
|
||
"id" : 849,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:849",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552643953,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 0,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 850,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:850",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552643953,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 1,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 851,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:851",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552643954,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 2,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 852,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:852",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552643954,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 3,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 853,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:853",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552643954,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 4,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 854,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:854",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552643954,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 5,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 855,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:855",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552643954,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 6,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 856,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:856",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552643954,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 7,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
} ],
|
||
"okinaVehicleJourneys" : null,
|
||
"etat" : 1,
|
||
"supprime" : true,
|
||
"okinaRoute" : null,
|
||
"okinaDepartureStopPoint" : null,
|
||
"okinaArrivalStopPoint" : null,
|
||
"filled" : false
|
||
},
|
||
"okinaRoute" : null,
|
||
"etat" : 1,
|
||
"supprime" : false,
|
||
"okinaVehicleJourneyAtStops" : null,
|
||
"counterGroups" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
},
|
||
"okinaJourneyPattern" : null,
|
||
"position" : 1,
|
||
"originDestination" : {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 3
|
||
}
|
||
} ],
|
||
"oppositeOds" : [ {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 1
|
||
} ],
|
||
"way" : "WAY_BACK"
|
||
}, {
|
||
"id" : {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 4
|
||
},
|
||
"institution" : {
|
||
"id" : 276,
|
||
"schoolEstablishmentUai" : "0360155Y",
|
||
"okinaStopAreas" : null
|
||
},
|
||
"originDestinationSequenceElements" : [ {
|
||
"id" : 4,
|
||
"okinaVehicleJourney" : {
|
||
"detached" : false,
|
||
"objectId" : "Europe Voyages 23:VehicleJourney:85",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491516000000,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"id" : 85,
|
||
"comment" : null,
|
||
"transportMode" : null,
|
||
"publishedJourneyName" : "SYNDICAT ARDENTES 4 (semaine Retour)",
|
||
"publishedJourneyIdentifier" : "SYNDICAT ARDENTES 4 (semaine Retour)",
|
||
"facility" : null,
|
||
"vehicleTypeIdentifier" : null,
|
||
"number" : 85,
|
||
"mobilityRestrictedSuitability" : null,
|
||
"flexibleService" : null,
|
||
"route" : null,
|
||
"journeyPattern" : null,
|
||
"company" : null,
|
||
"footnotes" : null,
|
||
"timetables" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"journeyCategory" : "Timesheet",
|
||
"journeyFrequencies" : null,
|
||
"okinaJourneyPattern" : {
|
||
"detached" : false,
|
||
"objectId" : "europevoyages:JourneyPattern:87",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491516000000,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"id" : 87,
|
||
"name" : "écoles St Vincent, Antoine Fée et St Martin vers Brenne 1 (semaine Retour)",
|
||
"comment" : null,
|
||
"registrationNumber" : null,
|
||
"publishedName" : "écoles St Vincent, Antoine Fée et St Martin vers Brenne 1",
|
||
"sectionStatus" : "Todo",
|
||
"route" : null,
|
||
"departureStopPoint" : null,
|
||
"arrivalStopPoint" : null,
|
||
"stopPoints" : null,
|
||
"vehicleJourneys" : null,
|
||
"routeSections" : null,
|
||
"okinaStopPoints" : [ {
|
||
"id" : 833,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:833",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552070527,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 0,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 834,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:834",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552070528,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 1,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 835,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:835",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552070528,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 2,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 836,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:836",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552070529,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 3,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 837,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:837",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552070529,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 4,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 838,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:838",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552070530,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 5,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 839,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:839",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552070530,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 6,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
}, {
|
||
"id" : 840,
|
||
"detached" : false,
|
||
"objectId" : "chateauroux:StopPoint:840",
|
||
"objectVersion" : 1,
|
||
"creationTime" : 1491552070530,
|
||
"creatorId" : null,
|
||
"saved" : false,
|
||
"position" : 7,
|
||
"forBoarding" : null,
|
||
"forAlighting" : null,
|
||
"containedInStopArea" : null,
|
||
"route" : null,
|
||
"comment" : null,
|
||
"okinaRoute" : null,
|
||
"okinaContainedInStopArea" : null,
|
||
"journeyPatternsDestination" : null,
|
||
"journeyPatternsOrigin" : null,
|
||
"okinaJourneyPatterns" : null,
|
||
"vehicleJourneyAtStops" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
} ],
|
||
"okinaVehicleJourneys" : null,
|
||
"etat" : 0,
|
||
"supprime" : true,
|
||
"okinaRoute" : null,
|
||
"okinaDepartureStopPoint" : null,
|
||
"okinaArrivalStopPoint" : null,
|
||
"filled" : false
|
||
},
|
||
"okinaRoute" : null,
|
||
"etat" : 0,
|
||
"supprime" : false,
|
||
"okinaVehicleJourneyAtStops" : null,
|
||
"counterGroups" : null,
|
||
"registrationNumber" : null,
|
||
"filled" : false
|
||
},
|
||
"okinaJourneyPattern" : null,
|
||
"position" : 1,
|
||
"originDestination" : {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 4
|
||
}
|
||
} ],
|
||
"oppositeOds" : [ {
|
||
"institutionId" : 276,
|
||
"sequenceNumber" : 1
|
||
} ],
|
||
"way" : "WAY_BACK"
|
||
} ],
|
||
"way" : "WAY_TO"
|
||
} ]
|
||
|
||
'''
|
||
|
||
# https://iti.okina.fr/api/Okina/REST/b2b/topology/lines
|
||
LINES = '''[ {
|
||
"id" : 45,
|
||
"name" : "019 - 02 - VELLES LYCEES DE CHATEAUROUX"
|
||
}, {
|
||
"id" : 3,
|
||
"name" : "ARTHON COLLEGE 1"
|
||
}, {
|
||
"id" : 4,
|
||
"name" : "ARTHON COLLEGE 2"
|
||
} ]
|
||
|
||
'''
|
||
|
||
# https://iti.okina.fr/api/Okina/REST/b2b/topology/networks
|
||
NETWORKS = '''[ {
|
||
"id" : 2,
|
||
"name" : "réseau scolaire"
|
||
} ]
|
||
|
||
'''
|
||
|
||
# https://iti.okina.fr/api/Okina/REST/b2b/topology/vehicle-journeys
|
||
VEHICLE_JOURNEYS = '''[ {
|
||
"id" : 306,
|
||
"name" : "019 02 - VELLES LYCEES DE CHATEAUROUX"
|
||
}, {
|
||
"id" : 307,
|
||
"name" : "019-02 - VELLES LYCEES DE CHATEAUROUX"
|
||
}, {
|
||
"id" : 305,
|
||
"name" : "019-02 - VELLES LYCEES DE CHATEAUROUX"
|
||
} ]
|
||
|
||
'''
|
||
|
||
QRCODE_400 = '''{
|
||
"code" : 3,
|
||
"status" : 400,
|
||
"message" : "Subscriber with ID 123 has no passcard number to generate qr code from."
|
||
}'''
|
||
|
||
QRCODE_404 = '''{
|
||
"code" : 1,
|
||
"status" : 404,
|
||
"message" : "Subscriber with ID 123 not found."
|
||
}'''
|
||
|
||
@pytest.fixture
|
||
def okina(db):
|
||
return Okina.objects.create(slug='test',
|
||
service_url='https://okina.example.net/b2b/',
|
||
username='usertest',
|
||
password='userpass')
|
||
|
||
|
||
def test_okina_cities(app, okina):
|
||
endpoint = utils.generic_endpoint_url('okina', 'cities', slug=okina.slug)
|
||
assert endpoint == '/okina/test/cities'
|
||
with mock.patch('passerelle.utils.Request.get') as requests_get:
|
||
requests_get.return_value = utils.FakedResponse(content=CITIES,
|
||
status_code=200)
|
||
resp = app.get(endpoint, status=200)
|
||
assert requests_get.call_count == 1
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/cities'
|
||
assert requests_get.call_args[1]['auth'] == ('usertest', 'userpass')
|
||
assert 'data' in resp.json
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 2
|
||
assert resp.json['data'][0]['id'] == '83355'
|
||
assert resp.json['data'][0]['insee'] == '36005'
|
||
assert resp.json['data'][0]['text'] == 'ARDENTES (36120)'
|
||
|
||
def test_okina_classes(app, okina):
|
||
endpoint = utils.generic_endpoint_url('okina', 'classes', slug=okina.slug)
|
||
assert endpoint == '/okina/test/classes'
|
||
with mock.patch('passerelle.utils.Request.get') as requests_get:
|
||
requests_get.return_value = utils.FakedResponse(content=CLASSES,
|
||
status_code=200)
|
||
resp = app.get(endpoint, status=200)
|
||
assert requests_get.call_count == 1
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/classes'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 4
|
||
assert resp.json['data'][0]['id'] == '1'
|
||
assert resp.json['data'][0]['text'] == u'École maternelle - Petite section'
|
||
|
||
def test_okina_institutions(app, okina):
|
||
endpoint = utils.generic_endpoint_url('okina', 'institutions', slug=okina.slug)
|
||
assert endpoint == '/okina/test/institutions'
|
||
with mock.patch('passerelle.utils.Request.get') as requests_get:
|
||
requests_get.return_value = utils.FakedResponse(content=INSTITUTIONS,
|
||
status_code=200)
|
||
resp = app.get(endpoint, status=200)
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/institutions'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 2
|
||
assert resp.json['data'][0]['id'] == '277'
|
||
assert resp.json['data'][0]['text'] == u'Collège Touvent'
|
||
|
||
resp = app.get(endpoint + '/from-city/36005/', status=200)
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/institutions/subscriberCity/36005'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 2
|
||
assert resp.json['data'][0]['id'] == '277'
|
||
assert resp.json['data'][0]['text'] == u'Collège Touvent'
|
||
|
||
def test_okina_stops_area(app, okina):
|
||
endpoint = utils.generic_endpoint_url('okina', 'stop-areas', slug=okina.slug)
|
||
assert endpoint == '/okina/test/stop-areas'
|
||
with mock.patch('passerelle.utils.Request.get') as requests_get:
|
||
requests_get.return_value = utils.FakedResponse(content=STOPS,
|
||
status_code=200)
|
||
resp = app.get(endpoint + '/from-city/36005/to-institution/276/', status=200)
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/stop-areas/subscriberCity/36005/institution/276'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 3
|
||
assert resp.json['data'][0]['id'] == '3281'
|
||
assert resp.json['data'][0]['text'] == u'Les Loges de Dressais'
|
||
|
||
def test_okina_ods(app, okina):
|
||
endpoint = utils.generic_endpoint_url('okina', 'origin-destinations', slug=okina.slug)
|
||
assert endpoint == '/okina/test/origin-destinations'
|
||
with mock.patch('passerelle.utils.Request.get') as requests_get:
|
||
requests_get.return_value = utils.FakedResponse(content=ODS, status_code=200)
|
||
resp = app.get(endpoint, status=200)
|
||
assert requests_get.call_count == 1
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/ods'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 2
|
||
assert resp.json['data'][0]['id'] == 'inst:276-seq:1-6-84'
|
||
assert resp.json['data'][0]['text'] == 'SYNDICAT ARDENTES 4 (semaine Aller)'
|
||
assert resp.json['data'][0]['identifier'] == 'SYNDICAT ARDENTES 4 (semaine Aller)'
|
||
assert resp.json['data'][0]['vehicle_journey_id'] == '84'
|
||
|
||
requests_get.return_value = utils.FakedResponse(content=ODS, status_code=200)
|
||
resp = app.get(endpoint + '/to-institution/276/', status=200)
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/ods/institution/276'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 2
|
||
assert resp.json['data'][0]['id'] == 'inst:276-seq:1-6-84'
|
||
assert resp.json['data'][0]['text'] == 'SYNDICAT ARDENTES 4 (semaine Aller)'
|
||
assert resp.json['data'][0]['identifier'] == 'SYNDICAT ARDENTES 4 (semaine Aller)'
|
||
assert resp.json['data'][0]['vehicle_journey_id'] == '84'
|
||
|
||
requests_get.return_value = utils.FakedResponse(content=ODS_LINES, status_code=200)
|
||
resp = app.get(endpoint + '/from-stop-area/3282/to-institution/276/', status=200)
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/ods/institution/276/stop-area/3282'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 3
|
||
assert resp.json['data'][0]['id'] == '1'
|
||
assert resp.json['data'][0]['text'] == 'LIGNE 24'
|
||
assert len(resp.json['data'][0]['lines']) == 1
|
||
assert resp.json['data'][0]['lines'][0]['id'] == '24'
|
||
assert resp.json['data'][0]['lines'][0]['text'] == 'LIGNE 24'
|
||
assert resp.json['data'][1]['id'] == '2'
|
||
assert resp.json['data'][1]['text'] == 'LIGNE 22'
|
||
assert len(resp.json['data'][1]['lines']) == 1
|
||
assert resp.json['data'][1]['lines'][0]['id'] == '22'
|
||
assert resp.json['data'][1]['lines'][0]['text'] == 'LIGNE 22'
|
||
assert resp.json['data'][2]['id'] == '3'
|
||
assert resp.json['data'][2]['text'] == 'LIGNE 24 + LIGNE 23'
|
||
assert len(resp.json['data'][2]['lines']) == 2
|
||
assert resp.json['data'][2]['lines'][0]['id'] == '24'
|
||
assert resp.json['data'][2]['lines'][0]['text'] == 'LIGNE 24'
|
||
assert resp.json['data'][2]['lines'][1]['id'] == '23'
|
||
assert resp.json['data'][2]['lines'][1]['text'] == 'LIGNE 23'
|
||
|
||
requests_get.return_value = utils.FakedResponse(content=ODS_FULL, status_code=200)
|
||
resp = app.get(endpoint + '/from-city/36005/to-institution/276/', status=200)
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/ods/institution/276/subscriberCity/36005'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 1
|
||
assert resp.json['data'][0]['id'] == 'inst:276-seq:1-6-84'
|
||
assert resp.json['data'][0]['text'] == u'Brenne 1 vers écoles Antoine Fée, Saint Martin et Saint Vincent'
|
||
assert resp.json['data'][0]['identifier'] == 'SYNDICAT ARDENTES 4 (semaine Aller)'
|
||
assert resp.json['data'][0]['vehicle_journey_id'] == '84'
|
||
|
||
requests_get.return_value = utils.FakedResponse(content=ODS_FULL, status_code=200)
|
||
resp = app.get(endpoint + '/from-city/36005/', status=200)
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/ods/subscriberCity/36005'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 1
|
||
assert resp.json['data'][0]['id'] == 'inst:276-seq:1-6-84'
|
||
assert resp.json['data'][0]['text'] == u'Brenne 1 vers écoles Antoine Fée, Saint Martin et Saint Vincent'
|
||
assert resp.json['data'][0]['identifier'] == 'SYNDICAT ARDENTES 4 (semaine Aller)'
|
||
assert resp.json['data'][0]['vehicle_journey_id'] == '84'
|
||
|
||
def test_okina_topology(app, okina):
|
||
endpoint = utils.generic_endpoint_url('okina', 'topology', slug=okina.slug)
|
||
assert endpoint == '/okina/test/topology'
|
||
with mock.patch('passerelle.utils.Request.get') as requests_get:
|
||
requests_get.return_value = utils.FakedResponse(content=LINES, status_code=200)
|
||
resp = app.get(endpoint + '/lines/', status=200)
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/topology/lines'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 3
|
||
assert resp.json['data'][0]['id'] == '45'
|
||
assert resp.json['data'][0]['text'] == '019 - 02 - VELLES LYCEES DE CHATEAUROUX'
|
||
|
||
requests_get.return_value = utils.FakedResponse(content=NETWORKS, status_code=200)
|
||
resp = app.get(endpoint + '/networks/', status=200)
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/topology/networks'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 1
|
||
assert resp.json['data'][0]['id'] == '2'
|
||
assert resp.json['data'][0]['text'] == u'réseau scolaire'
|
||
|
||
requests_get.return_value = utils.FakedResponse(content=VEHICLE_JOURNEYS, status_code=200)
|
||
resp = app.get(endpoint + '/vehicle-journeys/', status=200)
|
||
assert requests_get.call_args[0][0] == 'https://okina.example.net/b2b/topology/vehicle-journeys'
|
||
assert resp.json['err'] == 0
|
||
assert len(resp.json['data']) == 3
|
||
assert resp.json['data'][0]['id'] == '306'
|
||
assert resp.json['data'][0]['text'] == u'019 02 - VELLES LYCEES DE CHATEAUROUX'
|
||
|
||
def test_okina_errors(app, okina):
|
||
with mock.patch('passerelle.utils.Request.get') as requests_get:
|
||
for response in ((200, '{"foo": "bar"}'), # not a list
|
||
(200, '{["foo": "bar"]}'), # list of malformatted dict
|
||
(200, '<h1>Welcome</h1>'), # bad json
|
||
(403, '<h1>Bad creds</h1>'),
|
||
(404, '<h1>Not Found</h1>'),
|
||
(500, '<h1>Crash</h1>'),
|
||
):
|
||
requests_get.return_value = utils.FakedResponse(content=response[1],
|
||
status_code=response[0])
|
||
resp = app.get('/okina/test/cities', status=500)
|
||
assert resp.json['err'] == 1
|
||
assert resp.json['data'] == None
|
||
|
||
# "normal" 401/403 response, ie problem with login/password
|
||
for status_code in (401, 403):
|
||
requests_get.return_value = utils.FakedResponse(content='''{"message": "Invalid credentials",
|
||
"code": 4, "status" : %d}''' % status_code, status_code=status_code)
|
||
resp = app.get('/okina/test/cities', status=500)
|
||
assert resp.json['err'] == 1
|
||
assert resp.json['err_desc'] == "Invalid credentials"
|
||
assert resp.json['data'] is None
|
||
|
||
def test_okina_suscribe(app, okina):
|
||
|
||
for service in ('subscriber', 'subscription'):
|
||
endpoint = utils.generic_endpoint_url('okina', service, slug=okina.slug)
|
||
assert endpoint == '/okina/test/%s' % service
|
||
with mock.patch('passerelle.utils.Request.get') as requests_get:
|
||
resp = app.post(endpoint, status=403)
|
||
assert requests_get.call_count == 0
|
||
assert resp.json['err'] == 1
|
||
assert resp.json['err_class'] == 'django.core.exceptions.PermissionDenied'
|
||
# open access
|
||
api = ApiUser.objects.create(username='all', keytype='', key='')
|
||
obj_type = ContentType.objects.get_for_model(okina)
|
||
AccessRight.objects.create(codename='can_access', apiuser=api, resource_type=obj_type,
|
||
resource_pk=okina.pk)
|
||
for service in ('subscriber', 'subscription'):
|
||
endpoint = utils.generic_endpoint_url('okina', service, slug=okina.slug)
|
||
assert endpoint == '/okina/test/%s' % service
|
||
with mock.patch('passerelle.utils.Request.post') as requests_get:
|
||
resp = app.post(endpoint, status=400) # no payload
|
||
assert requests_get.call_count == 0
|
||
assert resp.json['err'] == 1
|
||
assert resp.json['err_class'] == 'passerelle.utils.jsonresponse.APIError'
|
||
assert resp.json['err_desc'] == 'payload must be a JSON object'
|
||
|
||
resp = app.post_json(endpoint, params=[], status=400) # bad payload
|
||
assert requests_get.call_count == 0
|
||
assert resp.json['err'] == 1
|
||
assert resp.json['err_class'] == 'passerelle.utils.jsonresponse.APIError'
|
||
assert resp.json['err_desc'] == 'payload must be a dict'
|
||
|
||
requests_get.return_value = utils.FakedResponse(content='{"foo":"bar"}', status_code=200)
|
||
resp = app.post_json(endpoint, params={'x':'y'})
|
||
assert requests_get.call_count == 1
|
||
assert resp.json['err'] == 0
|
||
assert resp.json['data'] == {'foo': 'bar'}
|
||
|
||
# qrcode
|
||
endpoint = '/okina/test/subscriber/123/qrcode'
|
||
with mock.patch('passerelle.utils.Request.get') as requests_get:
|
||
requests_get.return_value = utils.FakedResponse(content='PNGfoo',
|
||
headers={'Content-Type': 'image/png'},
|
||
status_code=200)
|
||
resp = app.get(endpoint)
|
||
assert requests_get.call_count == 1
|
||
assert resp.headers['content-type'] == 'image/png'
|
||
assert resp.content == 'PNGfoo'
|
||
|
||
requests_get.return_value = utils.FakedResponse(content=QRCODE_400,
|
||
headers={'Content-Type': 'application/json' },
|
||
status_code=400)
|
||
resp = app.get(endpoint, status=400)
|
||
assert requests_get.call_count == 2
|
||
assert resp.json == {
|
||
u'err': 1,
|
||
u'err_class': u'passerelle.utils.jsonresponse.APIError',
|
||
u'err_desc': u'Subscriber with ID 123 has no passcard number to generate qr code from.',
|
||
u'data': None,
|
||
}
|
||
|
||
requests_get.return_value = utils.FakedResponse(content=QRCODE_404,
|
||
headers={'Content-Type': 'application/json' },
|
||
status_code=404)
|
||
resp = app.get(endpoint, status=404)
|
||
assert requests_get.call_count == 3
|
||
assert resp.json == {
|
||
u'err': 1,
|
||
u'err_class': u'passerelle.utils.jsonresponse.APIError',
|
||
u'err_desc': u'Subscriber with ID 123 not found.',
|
||
u'data': None,
|
||
}
|