def update_provider():
     json = {
         "navitia_service": 'realtime_proxies',
         "klass": 'jormungandr.realtime_schedule.siri.Siri',
         "args": {
             "requestor_ref": "AA_Siri_TAO",
             "service_url": "http://new_url_siri.com",
             "timeout": 10
         },
     }
     external_service = ExternalService(id='Siri_TAO', json=json)
     external_service.updated_at = datetime.datetime.utcnow()
     return [external_service]
 def provider():
     json = {
         "navitia_service": 'realtime_proxies',
         "klass": 'jormungandr.realtime_schedule.siri.Siri',
         "args": {
             "requestor_ref": "AA_Siri_TAO",
             "service_url": "http://siri.com",
             "timeout": 1
         },
     }
     return [ExternalService(id='Siri_TAO', json=json)]
 def provider():
     json = {
         "navitia_service": 'realtime_proxies',
         "klass": 'jormungandr.realtime_schedule.sytral.Sytral',
         "args": {
             "service_url": "http://sytralrt.com",
             "timeout": 10,
             "object_id_tag": "source"
         },
     }
     return [ExternalService(id='SytralRT', json=json)]
def vehicle_occcupancy_services_getter_update():
    service = ExternalService(id='forseti_vehicle_occupancies')
    service.navitia_service = 'vehicle_occupancies'
    service.klass = 'jormungandr.external_services.vehicle_occupancy.VehicleOccupancyProvider'
    service.args = {'service_url': 'http://update/vehicle_occupancies', 'timeout': 15}
    service.created_at = datetime.datetime.utcnow()
    return [service]
def services_getter_update_with_wrong_class():
    service = ExternalService(id='forseti_free_floatings')
    service.navitia_service = 'free_floatings'
    service.klass = 'jormungandr.external_services.free_floating.Toto'
    service.args = {'service_url': 'http://update/free_floatings', 'timeout': 10}
    service.created_at = datetime.datetime.utcnow()
    return [service]
def mock_get_realtime_proxies_from_db():
    rt_proxies = dict()
    json = {
        "navitia_service": 'realtime_proxies',
        "klass": 'jormungandr.realtime_schedule.cleverage.Cleverage',
        "args": {
            'service_url': 'https://clever_age.come',
            'timeout': 1,
            "timezone": "Europe/Paris",
            "service_args": {
                "X-Keolis-Api-Version": "1.0",
                "X-Keolis-Api-Key": "KISIO_2021"
            },
        },
    }
    rt_proxies["clever_age_TBC"] = ExternalService(id='clever_age_TBC',
                                                   json=json)

    json = {
        "navitia_service": 'realtime_proxies',
        "klass": 'jormungandr.realtime_schedule.sytral.Sytral',
        "args": {
            "service_url": "http://sytralrt.com",
            "timeout": 10,
            "object_id_tag": "source"
        },
    }
    rt_proxies["SytralRT"] = ExternalService(id='SytralRT', json=json)

    json = {
        "navitia_service": 'realtime_proxies',
        "klass": 'jormungandr.realtime_schedule.timeo.Timeo',
        "args": {
            "timeout": 1,
            "timezone": "Europe/Paris",
            "service_url": "http://timeo.com",
            "service_args": {
                "Media": "ss_mb",
                "EntityID": "230",
                "serviceID": "4"
            },
            "destination_id": None,
        },
    }
    rt_proxies["Timeo_Amelys"] = ExternalService(id='Timeo_Amelys', json=json)

    json = {
        "navitia_service": 'realtime_proxies',
        "klass": 'jormungandr.realtime_schedule.siri.Siri',
        "args": {
            "requestor_ref": "AA_Siri_TAO",
            "service_url": "http://siri.com",
            "timeout": 1
        },
    }
    rt_proxies["Siri_TAO"] = ExternalService(id='Siri_TAO', json=json)

    json = {
        "navitia_service": 'realtime_proxies',
        "klass": 'jormungandr.realtime_schedule.siri_lite.SiriLite',
        "args": {
            "service_url": "https://siri_stif.com",
            "timeout": 1
        },
    }
    rt_proxies["siri_stif"] = ExternalService(id='siri_stif', json=json)

    return list(rt_proxies.values())
def services_getter_ok():
    service1 = ExternalService(id='forseti_free_floatings')
    service1.navitia_service = 'free_floatings'
    service1.klass = 'jormungandr.external_services.free_floating.FreeFloatingProvider'
    service1.args = {'service_url': 'http://config_from_db/free_floatings', 'timeout': 5}
    service1.created_at = datetime.datetime.utcnow()

    service2 = ExternalService(id='forseti_vehicle_occupancies')
    service2.navitia_service = 'vehicle_occupancies'
    service2.klass = 'jormungandr.external_services.vehicle_occupancy.VehicleOccupancyProvider'
    service2.args = {'service_url': 'http://127.0.0.1:8080/vehicle_occupancies', 'timeout': 10}
    service2.created_at = datetime.datetime.utcnow()
    return [service1, service2]