def test_get_busstop_for_service(self):
        """ test bus stops for concrete service  """
        request = self.factory.get('/android/requestBusStopsByService/')
        request.user = AnonymousUser()

        reponseView = BusStopsByService()
        response = reponseView.get(request, self.service)

        jsonResponse = json.loads(response.content)

        self.assertEqual(jsonResponse['service'], self.service)
        index = 0
        for busStop in jsonResponse['paraderos']:
            self.assertEqual(
                busStop['latitud'],
                self.busStopObjs[index].latitud)
            self.assertEqual(
                busStop['longitud'],
                self.busStopObjs[index].longitud)
            self.assertEqual(busStop['nombre'], self.busStopObjs[index].name)
            self.assertEqual(busStop['codigo'], self.busStopObjs[index].code)
            index += 1
Esempio n. 2
0
        r'^reportEventBusStop/(?P<pUserId>[0-9a-z-]+)/(?P<pBusStopCode>[\w,0-9]*)/(?P<pEventID>.*)/(?P<pLatitud>[\-+]?[0-9]*\.?[0-9]*)/(?P<pLongitud>[\-+]?[0-9]*\.?[0-9]*)/(?P<pConfirmDecline>.*)$',
        RegisterEventBusStop.as_view()),
    url(
        r'^reportEventBusStop/(?P<pUserId>[0-9a-z-]+)/(?P<pBusStopCode>[\w,0-9]*)/(?P<pEventID>.*)/(?P<pConfirmDecline>.*)$',
        RegisterEventBusStop.as_view()),
    # List of events that depend of parameter pWhich={stopstop,stopbus, busbus}
    url(r'^requestEventsToNotified/(?P<pWhich>[\w,0-9]*)$',
        RequestEventsToNotified.as_view()),
    # List of bus events
    url(
        r'^requestEventsForBus/(?P<pRegistrationPlate>[\w,0-9,-]{6,8})/(?P<pBusService>[\w,0-9]*)$',
        EventsByBus.as_view()),
    url(r'^requestEventsForBus/v2/(?P<pUuid>[0-9a-z-]+)$',
        EventsByBusV2.as_view()),
    # List of bus stop events
    url(
        r'^requestEventsForBusStop/(?P<pBusStopCode>[\w,0-9]*)$',
        EventsByBusStop.as_view()),
    # List of bus stop of a service
    url(
        r'^requestBusStopsForService/(?P<pBusService>[\w,0-9]*)$',
        BusStopsByService.as_view()),
    url(
        r'^requestRouteForService/(?P<pBusService>[\w,0-9]*)/(?P<pLat1>[\-+]?[0-9]*\.?[0-9]*)/(?P<pLon1>[\-+]?[0-9]*\.?[0-9]*)/(?P<pLat2>[\-+]?[0-9]*\.?[0-9]*)/(?P<pLon2>[\-+]?[0-9]*\.?[0-9]*)$',
        ServiceRoute.as_view()),
    # setDirection receives parameter by POST
    url(r'^setDirection$', SetDirection.as_view()),
    url(r'^getUUID/(?P<pLicensePlate>[\w,0-9,-]{6,8})$',
        RequestUUID.as_view()),
]