Esempio n. 1
0
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
Esempio n. 2
0
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))
Esempio n. 3
0
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)
Esempio n. 4
0
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)
Esempio n. 5
0
def test_valid_destinations():
    maestro = Booker()
    
    for elem in maestro.destinations:
        assert(alpha_or_string(elem) == True)
Esempio n. 6
0
def main():
    maestro = Booker()

    while maestro.exit == False:
        maestro.main_menu()
Esempio n. 7
0
def test_ticket_number():
    booker = Booker()
    p1 = Passenger("Norbert", 101)
    booker.reserve_ticket(p1, True)
    assert len(booker.ticket_list) == 1