Example #1
0
def test_get_availability_for_existing_date():
    p = Provider('1', '1', '1', '', '', '')
    p.add_centre('rand')
    p.get_availability('rand', 2019, 9, 20)
    p.make_time_slot_unavailable('rand', 2019, 9, 20, '08:30')
    val = p.get_availability('rand', 2019, 9, 20)
    assert ('08:30' not in val and type(val) is list)
Example #2
0
def test_make_non_existing_and_available_slots_unavailable():
    p = Provider('1', '1', '1', '', '', '')
    p.add_centre('rand')
    p.get_availability('rand', 2019, 9, 20)
    checker = p.make_time_slot_unavailable('rand', 2019, 9, 20, '08:30')
    assert (checker == True)
    val = p.get_availability('rand', 2019, 9, 20)
    assert ('08:30' not in val)
    checker = p.make_time_slot_unavailable('rand', 2019, 9, 20, '09:30')
    val = p.get_availability('rand', 2019, 9, 20)
    assert ('08:30' not in val and '09:30' not in val)
Example #3
0
def test_get_availability_for_non_existing_centre_but_valid_date():
    p = Provider('1', '1', '1', '', '', '')
    # p.add_centre('rand')
    with pytest.raises(BookingError) as info:
        p.get_availability('centre', 2019, 12, 14)
Example #4
0
def test_get_availability_for_existing_centre_and_valid_date():
    p = Provider('1', '1', '1', '', '', '')
    p.add_centre('rand')
    with pytest.raises(DateTimeValidityError) as info:
        checker = p.get_availability('rand', 2018, 19, 220)
Example #5
0
def test_get_availability_invalid_date():
    p = Provider('1', '1', '1', '', '', '')
    with pytest.raises(DateTimeValidityError) as info:
        checker = p.get_availability('centre', 13, 22, 414)
    with pytest.raises(DateTimeValidityError) as info:
        checker = p.get_availability('centre', 'lol', 22, 414)