예제 #1
0
def test_parse_ordoclic_slots():
    # Test availability_data vide
    request = ScraperRequest("", "2021-04-05")
    assert parse_ordoclic_slots(request, {}) == None

    # Test pas de slots disponibles
    empty_slots_file = Path("tests/fixtures/ordoclic/empty_slots.json")
    empty_slots = json.loads(empty_slots_file.read_text())
    request = ScraperRequest("", "2021-04-05")
    assert parse_ordoclic_slots(request, empty_slots) == None

    # Test nextAvailableSlotDate
    nextavailable_slots_file = Path(
        "tests/fixtures/ordoclic/nextavailable_slots.json")
    nextavailable_slots = json.loads(nextavailable_slots_file.read_text())
    request = ScraperRequest("", "2021-04-05")
    assert parse_ordoclic_slots(request, nextavailable_slots) == isoparse(
        "2021-06-12T11:30:00Z")  # timezone CET

    # Test slots disponibles
    full_slots_file = Path("tests/fixtures/ordoclic/full_slots.json")
    full_slots = json.loads(full_slots_file.read_text())
    request = ScraperRequest("", "2021-04-05")
    first_availability = parse_ordoclic_slots(request, full_slots)
    assert first_availability == isoparse(
        "2021-04-19T16:15:00Z")  # timezone CET
    assert request.appointment_count == 42
예제 #2
0
def test_get_slots():
    request = ScraperRequest("https://app.ordoclic.fr/app/pharmacie/pharmacie-de-la-mairie-meru-meru", "2021-05-08")
    data = {"id": 1}
    assert not parse_ordoclic_slots(request, data)

    request = ScraperRequest("https://app.ordoclic.fr/app/pharmacie/pharmacie-de-la-mairie-meru-meru", "2021-05-08")
    data = {"slots": [{"timeEnd": "2021-05-09"}]}
    assert not parse_ordoclic_slots(request, data)
예제 #3
0
def test_get_slots():
    request = ScraperRequest(
        "https://app.ordoclic.fr/app/pharmacie/pharmacie-de-la-mairie-meru-meru",
        "2021-05-08")
    data = {'id': 1}
    assert not parse_ordoclic_slots(request, data)

    request = ScraperRequest(
        "https://app.ordoclic.fr/app/pharmacie/pharmacie-de-la-mairie-meru-meru",
        "2021-05-08")
    data = {'slots': [{'timeEnd': '2021-05-09'}]}
    assert not parse_ordoclic_slots(request, data)