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_remove_existing_centre(): prov = Provider('*****@*****.**', '1234', 'McTester', 'Test', '124024114', 'Official Tester') assert (prov.centres == []) prov.add_centre('rand') assert ('rand' in prov.centres) checker = prov.remove_centre('RAnd') assert (checker == True) assert (prov.centres == [])
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_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_add_existing_centre(): pp1 = Provider('trst', '123', 'sad', '12312', '2323', 'Blah') assert (pp1.centres == []) pp1.add_centre('Randwick Hospital') pp1.add_centre('randwick hospital') assert (len(pp1.centres) == 1)
def test_add_non_existing_centre(): p1 = Provider('*****@*****.**', '1234', 'McTester', 'Test', '124024114', 'Official Tester') assert (p1.centres == []) p1.add_centre('Randwick Hospital') assert ('Randwick Hospital'.lower() in p1.centres)