def ridesharing_service_manager_config_from_file_and_db_test(): """ creation of a ridesharing service from database: InstantSystem creation of a ridesharing service from database : Blablalines Result: We have to find both services Blablalines and InstantSystem """ instance = MockInstance() ridesharing_manager = RidesharingServiceManager( instance, [], rs_services_getter=mock_get_attr_instant_system_and_blablalines) ridesharing_manager.init_ridesharing_services() ridesharing_manager.update_config() assert len(ridesharing_manager.ridesharing_services_configuration) == 0 assert len(list(ridesharing_manager._ridesharing_services.values())) == 2 assert ridesharing_manager._ridesharing_services[ "InstantSystem"].system_id == "instant_system" assert ridesharing_manager._ridesharing_services[ "Blablalines"].system_id == "blablalines" assert ridesharing_manager._rs_services_getter assert ridesharing_manager._update_interval == 60 assert ridesharing_manager._update_interval == 60 assert len(ridesharing_manager._ridesharing_services_legacy) == 0 services = ridesharing_manager.get_all_ridesharing_services() assert len(services) == 2
def two_same_ridesharing_service_manager_config_from_file_and_db_test(): """ creation of a ridesharing service from the configuration file: InstantSystem creation of a ridesharing service from database : InstantSystem Result: We must find the service InstantSystem """ instance = MockInstance() ridesharing_services_config = [config_instant_system] ridesharing_manager = RidesharingServiceManager( instance, ridesharing_services_config, rs_services_getter=mock_get_attr_instant_system) ridesharing_manager.init_ridesharing_services() ridesharing_manager.update_config() assert len(ridesharing_manager.ridesharing_services_configuration) == 1 assert len(list(ridesharing_manager._ridesharing_services.values())) == 1 assert ridesharing_manager._ridesharing_services[ "InstantSystem"].system_id == "instant_system" assert ridesharing_manager._rs_services_getter assert ridesharing_manager._update_interval == 60 assert ridesharing_manager._update_interval == 60 assert len(ridesharing_manager._ridesharing_services_legacy) == 0 services = ridesharing_manager.get_all_ridesharing_services() assert len(services) == 1