def testFind2(self):
     pr1 = PassengersRepo()
     pr2 = PlaneRepo()
     ctrl = Controller(pr2, pr1)
     p1 = Passengers('Ion', 'C', 'abc')
     p2 = Passengers('Ioana', 'B', 'abc2')
     p3 = Planes('Nume', 'A101', 'Wizair', 60, 'Cairo', [p1, p2])
     ctrl.addPlane(p3)
     p4 = Passengers('Ion', 'A', 'abc22')
     p5 = Passengers('Andrei', 'B', 'adc44')
     p6 = Planes('Nume1', 'A202', 'Wizz', 60, 'Cairo', [p4, p5])
     ctrl.addPlane(p6)
 def testSort3(self):
     pr1 = PassengersRepo()
     pr2 = PlaneRepo()
     ctrl = Controller(pr2, pr1)
     p1 = Passengers('Ion', 'C', '1')
     p2 = Passengers('Ioana', 'B', '1')
     p3 = Planes('Nume', 'A101', 'Wizair', 60, 'Cairo', [p1, p2])
     ctrl.addPlane(p3)
     p4 = Passengers('Ion', 'A', '1')
     p6 = Planes('Nume1', 'A202', 'Wizz', 1, 'Cairo', [p4])
     ctrl.addPlane(p6)
     ctrl.sortwithconcatenation()
     self.assertEqual(ctrl.getPlanesforTest(), [p6, p3])
 def testSort2(self):
     pr1 = PassengersRepo()
     pr2 = PlaneRepo()
     ctrl = Controller(pr2, pr1)
     p1 = Passengers('Ion', 'C', '1')
     p2 = Passengers('Ioana', 'B', '2')
     p3 = Planes('Nume', 'A101', 'Wizair', 60, 'Cairo', [p1, p2])
     ctrl.addPlane(p3)
     p4 = Passengers('Ion', 'A', '1')
     p5 = Passengers('Andrei', 'B', '2')
     p6 = Planes('Nume1', 'A202', 'Wizz', 60, 'Cairo', [p4, p5])
     ctrl.addPlane(p6)
     ctrl.sortwithletter('I')
     self.assertEqual(ctrl.getPlanesforTest(), [p6, p3])
 def testSort1(self):
     pr1 = PassengersRepo()
     pr2 = PlaneRepo()
     ctrl = Controller(pr2, pr1)
     p1 = Passengers('Ion', 'C', '1')
     p2 = Passengers('Ioana', 'B', '2')
     p3 = Planes('Nume', 'A101', 'Wizair', 60, 'Cairo', [p1, p2])
     ctrl.addPlane(p3)
     p4 = Passengers('Ion', 'A', '1')
     p5 = Passengers('Ioana', 'B', '2')
     p6 = Planes('Nume1', 'A202', 'Wizz', 60, 'Cairo', [p4, p5])
     ctrl.addPlane(p6)
     ctrl.sortbyLastName()
     self.assertEqual(ctrl.getPlanes()[0].getPassengers(), [p2, p1])
     self.assertEqual(ctrl.getPlanes()[1].getPassengers(), [p4, p5])
예제 #5
0
 def testadd(self):
     p = PlaneRepo()
     p1 = Passengers('Ion', 'Popescu', 1)
     p2 = Passengers('Ioana', 'Popescu', 2)
     p3 = Planes('Nume', 'A101', 'Wizair', 60, 'Cairo', [p1, p2])
     p.addPlane(p3)
     self.assertEqual(p.lenPlanes(), 1)
 def testBT2(self):
     pr1 = PassengersRepo()
     pr2 = PlaneRepo()
     ctrl = Controller(pr2, pr1)
     p1 = Passengers('Ion', 'C', 'abc')
     p2 = Passengers('Ioana', 'B', 'abc2')
     p3 = Planes('Nume1', 'A201', 'Wizair', 60, 'Cairo', [p1, p2])
     ctrl.addPlane(p3)
     p4 = Passengers('Ion', 'A', 'abc22')
     p5 = Passengers('Andrei', 'B', 'adc44')
     p6 = Planes('Nume2', 'A202', 'Wizair', 60, 'Cairo', [p4, p5])
     ctrl.addPlane(p6)
     p7 = Planes('Nume3', 'A203', 'Wair', 60, 'Cairo', [p4, p5])
     ctrl.addPlane(p7)
     p8 = Planes('Nume4', 'A204', 'Wizair', 60, 'Cairo', [p4, p5])
     ctrl.addPlane(p8)
     l1 = ctrl.form2(2)
예제 #7
0
 def menu(self):
     plane = Planes(string_input(),string_input(),string_input(),user_input(),string_input(),[])
     self.__ctrl.addPlane(plane)
     while True:
         PlanesMenu.printMenu()
         command = user_input()
         if command == -4:
             self.__ctrl.deletePlane(user_input())
         elif command == -3:
             self.__ctrl.deletePassengerinPlane(user_input(),string_input(),string_input())
         elif command == -2:
             plane = Planes(string_input(),string_input(),string_input(),user_input(),string_input(),[])
             self.__ctrl.addPlane(plane)
         elif command == -1:
             self.__ctrl.addPassengerinPlane(string_input(),string_input(),string_input(),string_input(),string_input())
         elif command == 0:
             exit()
         elif command == 1:
             print(self.__ctrl.listPlane())
         elif command == 2:
             self.__ctrl.sortbyLastName()
             print(self.__ctrl.listPlane())
         elif command == 3:
             self.__ctrl.sortbyletter(string_input())
         elif command == 4:
             self.__ctrl.sortbyconcatenation()
         elif command == 5:
             l = self.__ctrl.find_by_nr()
             print(l)
         elif command == 6:
             l = self.__ctrl.find_by_str(user_input(),string_input())
             print(l)
         elif command == 7:
             l = self.__ctrl.find_by_name(string_input(),string_input())
             print(l)
         elif command == 8:
             self.__ctrl.form1(user_input())
         elif command == 9:
             self.__ctrl.form2(user_input())
         else:
             print('Not a valid option')
예제 #8
0
 def testUpdate(self):
     p = PlaneRepo()
     p1 = Passengers('Ion', 'Popescu', 1)
     p2 = Passengers('Ioana', 'Popescu', 2)
     p3 = Planes('Nume', 'A101', 'Wizair', 60, 'Cairo', [p1, p2])
     p.addPlane(p3)
     p.updateName('Nume1', 0)
     p.updateNumber('A103', 0)
     p.updateCompany('Wizz', 0)
     p.updateSeats(100, 0)
     p.updateDestination('Lima', 0)
     self.assertEqual(p[0].getName(), 'Nume1')
     self.assertEqual(p[0].getNumber(), 'A103')
     self.assertEqual(p[0].getAirlineCompany(), 'Wizz')
     self.assertEqual(p[0].getNumberOfSeats(), 100)
     self.assertEqual(p[0].getDestination(), 'Lima')
 def testGettersSetters(self):
     p1 = Passengers('Ion','Popescu',1)
     p2 = Passengers('Ioana','Popescu',2)
     p = Planes('Nume','A101','Wizair',60,'Cairo',[p1,p2])
     self.assertEqual(p.getName(), 'Nume')
     self.assertEqual(p.getNumber(), 'A101')
     self.assertEqual(p.getAirlineCompany(), 'Wizair')
     self.assertEqual(p.getNumberOfSeats(), 60)
     self.assertEqual(p.getDestination(), 'Cairo')
     self.assertEqual(p.getPassengers(), [p1,p2])
     p.setName('Nume1')
     p.setNumber('A102')
     p.setAirlineCompany('Wizz')
     p.setNumberOfSeats(30)
     p.setDestination('Lima')
     p.setPassengers([p2,p1])
     self.assertEqual(p.getName(), 'Nume1')
     self.assertEqual(p.getNumber(), 'A102')
     self.assertEqual(p.getAirlineCompany(), 'Wizz')
     self.assertEqual(p.getNumberOfSeats(), 30)
     self.assertEqual(p.getDestination(), 'Lima')
     self.assertEqual(p.getPassengers(), [p2,p1])