def test_center_info_fill(): center = CenterInfo("Paris", "Centre 1", "https://.../centre") newloc = CenterLocation(1.122, 2.391, "Ok", "Cp") request = ScraperRequest(center.url, "2021-05-04") result = ScraperResult(request, "Doctolib", "2021-05-06") center.fill_localization(newloc) request.update_appointment_count(42) request.add_vaccine_type(Vaccine.PFIZER) request.add_vaccine_type(Vaccine.ASTRAZENECA) request.add_vaccine_type(Vaccine.MODERNA) request.update_internal_id("doctolibcentre1") request.update_practitioner_type(DRUG_STORE) request.set_appointments_only_by_phone(False) center.fill_result(result) assert center.location == newloc assert center.prochain_rdv == "2021-05-06" assert center.plateforme == "Doctolib" assert center.type == "drugstore" assert center.appointment_count == 42 assert center.internal_id == "doctolibcentre1" assert center.vaccine_type == ["Pfizer-BioNTech", "AstraZeneca", "Moderna"] assert not center.appointment_by_phone_only assert center.default() == { "departement": "Paris", "nom": "Centre 1", "url": "https://.../centre", "location": { "longitude": 1.122, "latitude": 2.391, "city": "Ok", "cp": "Cp" }, "metadata": None, "prochain_rdv": "2021-05-06", "plateforme": "Doctolib", "type": "drugstore", "appointment_count": 42, "internal_id": "doctolibcentre1", "vaccine_type": ["Pfizer-BioNTech", "AstraZeneca", "Moderna"], "appointment_by_phone_only": False, "erreur": None, "last_scan_with_availabilities": None, "appointment_schedules": None, "request_counts": None, }
def test_center_info_fill(): center = CenterInfo("Paris", "Centre 1", "https://.../centre") newloc = CenterLocation(1.122, 2.391, "Ok") request = ScraperRequest(center.url, "2021-05-04") result = ScraperResult(request, "Doctolib", "2021-05-06") center.fill_localization(newloc) request.update_appointment_count(42) request.add_vaccine_type(Vaccine.PFIZER) request.add_vaccine_type(Vaccine.ASTRAZENECA) request.add_vaccine_type(Vaccine.MODERNA) request.update_internal_id("doctolibcentre1") request.update_practitioner_type(DRUG_STORE) request.set_appointments_only_by_phone(False) center.fill_result(result) assert center.location == newloc assert center.prochain_rdv == "2021-05-06" assert center.plateforme == "Doctolib" assert center.type == "drugstore" assert center.appointment_count == 42 assert center.internal_id == "doctolibcentre1" assert center.vaccine_type == ["Pfizer-BioNTech", "AstraZeneca", "Moderna"] assert not center.appointment_by_phone_only assert center.default() == { 'departement': 'Paris', 'nom': 'Centre 1', 'url': 'https://.../centre', 'location': { 'longitude': 1.122, 'latitude': 2.391, 'city': 'Ok' }, 'metadata': None, 'prochain_rdv': '2021-05-06', 'plateforme': 'Doctolib', 'type': 'drugstore', 'appointment_count': 42, 'internal_id': 'doctolibcentre1', 'vaccine_type': ['Pfizer-BioNTech', 'AstraZeneca', 'Moderna'], 'appointment_by_phone_only': False, 'erreur': None, 'last_scan_with_availabilities': None, 'appointment_schedules': None }
def test_organization_to_center(): data_file = Path("tests/fixtures/avecmondoc/get_organization_slug.json") data = json.loads(data_file.read_text(encoding="utf8")) center = CenterInfo( "28", "Delphine ROUSSEAU", "https://patient.avecmondoc.com/fiche/structure/delphine-rousseau-159") center.metadata = { "address": "21 Rue Nicole 28000 Chartres", "phone_number": "0033143987678", "business_hours": { "Lundi": "08:30-12:30 13:30-17:00", "Mardi": "08:30-12:30 13:30-17:00", "Mercredi": "08:30-12:30 13:30-17:00", "Jeudi": "08:30-12:30 13:30-17:00", "Vendredi": "08:30-12:30 13:30-17:00", "Samedi": "", "Dimanche": "", }, } center.location = CenterLocation(1.481373, 48.447586, "Chartres", "28000") center.internal_id = "amd159" center.type = DRUG_STORE assert organization_to_center(data).default() == center.default()