def test_check_utils_functions(self): tables = Utils.create_tables_json() Utils.insert_reservation() assert Utils.check_number_of_reseservation() == 1 Utils.delete_all_reservations() assert Utils.check_number_of_reseservation() == 0
def test_get_free_tables_ok(self): tables = Utils.create_tables_json() Utils.insert_reservation(people_number=2) py_datetime = datetime.datetime(year=2021, month=4, day=27, hour=12, minute=30) free_tables = BookingService.get_free_tables(tables, 4, py_datetime, 30) # STILL TWO TABLES FREE assert len(free_tables) == 2 Utils.delete_all_reservations()
def test_get_free_tables_ko(self): tables = Utils.create_tables_json() Utils.insert_reservation(people_number=2) Utils.insert_reservation(people_number=3, table_id=2) Utils.insert_reservation(people_number=5, table_id=1) py_datetime = datetime.datetime(year=2021, month=4, day=27, hour=12, minute=30) free_tables = BookingService.get_free_tables(tables, 4, py_datetime, 30) # NO MORE TABLES assert len(free_tables) != 1 Utils.delete_all_reservations()
def test_get_min_seats_table_ok(self): tables = Utils.create_tables_json() min_seat_table = BookingService.get_min_seats_table(tables) assert min_seat_table == 3
def test_get_table_name_ko(self): tables = Utils.create_tables_json() result = BookingService.get_table_name(tables, 4) assert result == "NO_NAME"
def test_get_table_name_ok(self): tables = Utils.create_tables_json() result = BookingService.get_table_name(tables, 1) assert result == tables[0]["name"]
def test_fitler_table_min_seats_ko(self): tables = Utils.create_tables_json() result = BookingService.filter_table_min_seat(tables, 6) assert len(result) != len(tables)