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)
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)
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)
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)
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)