def test_duplicates_tickets(): maestro = Booker() name_list = [] passports = [] passengers = [] for i in range(50): name_list.append( "".join(random.choice(string.ascii_lowercase) for _ in range(7)) ) passports.append(random.randint(1000, 10000)) passengers.append(Passenger(name_list[i], passports[i])) maestro.reserve_ticket(passengers[i], True) assert checkIfDuplicates(maestro.ticket_list) == False
def test_overbooking(): maestro = Booker() name_list = [] passports = [] passengers = [] for i in range(random.randint(500, 5000)): name_list.append( "".join(random.choice(string.ascii_lowercase) for _ in range(7)) ) passports.append(random.randint(1000, 10000)) passengers.append(Passenger(name_list[i], passports[i])) maestro.reserve_ticket(passengers[i], True) for elem in maestro.destinations: assert(maestro.flight_dtb[elem].max >= len(maestro.flight_dtb[elem].passenger_list))
def test_valid_flight(): maestro = Booker() for elem in maestro.destinations: flight = maestro.flight_dtb[elem] dest = flight.destination assert(alpha_or_string(dest) == True)
def test_registered_passenger(): maestro = Booker() name_list = [] passports = [] passengers = [] for i in range(random.randint(500, 5000)): name_list.append( "".join(random.choice(string.ascii_lowercase) for _ in range(7)) ) passports.append(random.randint(1000, 10000)) passengers.append(Passenger(name_list[i], passports[i])) maestro.reserve_ticket(passengers[i], True) for elem in maestro.destinations: flight = maestro.flight_dtb[elem] for elem in flight.passenger_list: assert(elem in maestro.passenger_dtb[x] for x in passports)
def test_valid_destinations(): maestro = Booker() for elem in maestro.destinations: assert(alpha_or_string(elem) == True)
def main(): maestro = Booker() while maestro.exit == False: maestro.main_menu()
def test_ticket_number(): booker = Booker() p1 = Passenger("Norbert", 101) booker.reserve_ticket(p1, True) assert len(booker.ticket_list) == 1