Exemple #1
0
 def test_insertBooking(self):
     with BookingDatabaseUtils(self.connection) as db:
         count = self.countBooking()
         self.assertTrue(db.insertBooking(1, 1, '3', 1))
         self.assertTrue(count + 1 == self.countBooking())
         self.assertTrue(db.insertBooking(1, 1, '3', 1))
         self.assertTrue(count + 2 == self.countBooking())
Exemple #2
0
 def insertBooking(self, cust_id, car_id, start_date, start_time, end_date,
                   end_time, price, status):
     with BookingDatabaseUtils() as db:
         db.insertBooking(
             cust_id, car_id, start_date, start_time, end_date, end_time,
             self.getTotalBookingTime(start_date, start_time, end_date,
                                      end_time),
             self.getTotalBookingCost(start_date, start_time, end_date,
                                      end_time, price), status)
Exemple #3
0
    def test_setBookingDuration(self):
        with BookingDatabaseUtils(self.connection) as db:
            bookingID = 4
            duration = 1

            self.assertTrue(self.bookingExists(bookingID))
            self.assertFalse(self.bookingIsDurationValue(bookingID, duration))

            db.setBookingDuration(bookingID, duration)

            self.assertTrue(self.bookingIsDurationValue(bookingID, duration))
Exemple #4
0
    def test_cancelBooking(self):
        with BookingDatabaseUtils(self.connection) as db:
            count = self.countBooking()
            bookingID = 1

            self.assertTrue(self.bookingExists(bookingID))

            db.cancelBooking(bookingID)

            self.assertFalse(self.bookingExists(bookingID))
            self.assertTrue(count - 1 == self.countBooking())
Exemple #5
0
    def test_setBookingOngoing(self):
        with BookingDatabaseUtils(self.connection) as db:
            bookingID = 4

            self.assertTrue(self.bookingExists(bookingID))
            self.assertFalse(self.bookingIsOngoing(bookingID))

            db.setBookingOngoing(bookingID, 1)

            self.assertTrue(self.bookingIsOngoing(bookingID))

            db.setBookingOngoing(bookingID, 0)

            self.assertFalse(self.bookingIsOngoing(bookingID))
Exemple #6
0
 def getTop10DurationCount(self):
     with BookingDatabaseUtils() as db:
         return db.getTop10DurationCount()
Exemple #7
0
 def getTop10BookingCountForPrice(self):
     with BookingDatabaseUtils() as db:
         return db.getTop10PriceCount()
Exemple #8
0
 def getTop10BookingCountForMake(self):
     with BookingDatabaseUtils() as db:
         return db.getTop10CarIDCount()
Exemple #9
0
 def getTop10Make(self):
     with BookingDatabaseUtils() as db:
         return db.getTop10CarID()
Exemple #10
0
 def getDurationForGraph(self):
     with BookingDatabaseUtils() as db:
         return db.getTop10Duration()
Exemple #11
0
 def getBooking(self, booking_id):
     with BookingDatabaseUtils() as db:
         return db.getBooking(booking_id)
Exemple #12
0
 def cancelBooking(self, bookingID):
     with BookingDatabaseUtils() as db:
         db.cancelBooking(bookingID)
Exemple #13
0
 def cancelBooking(self, booking_id):
     with BookingDatabaseUtils() as db:
         db.updateStatus(2, booking_id)
Exemple #14
0
 def listCarBookingHistory(self, carID):
     with BookingDatabaseUtils() as db:
         return db.listCarBookingHistory(carID)
Exemple #15
0
 def listPersonalOngoingBooking(self, userID):
     with BookingDatabaseUtils() as db:
         return db.listPersonalOngoingBooking(userID)
Exemple #16
0
 def listPersonalBookingHistory(self, userID):
     with BookingDatabaseUtils() as db:
         return db.listPersonalBookingHistory(userID)
Exemple #17
0
 def listAllBooking(self):
     with BookingDatabaseUtils() as db:
         return db.listAllBooking()
Exemple #18
0
 def insertBooking(self, userID, CarID, duration):
     with BookingDatabaseUtils() as db:
         db.insertBooking(userID, CarID, duration, 1)
Exemple #19
0
 def getPersonalBookingHistory(self, cust_id):
     with BookingDatabaseUtils() as db:
         return db.getPersonalBookingHistory(cust_id)
Exemple #20
0
 def test_listPersonalOngoingBooking(self):
     userID = 1
     with BookingDatabaseUtils(self.connection) as db:
         self.assertTrue(self.countOngoingBookingByID(userID) == len(db.listPersonalOngoingBooking(userID)))
Exemple #21
0
 def createBookingTable(self):
     with BookingDatabaseUtils() as db:
         db.deleteTable()
         db.createBookingTable()
Exemple #22
0
 def getPersonalOngoingBooking(self, cust_id):
     with BookingDatabaseUtils() as db:
         return db.getPersonalOngingBooking(cust_id)
Exemple #23
0
 def setBookingOngoing(self, bookingID, ongoing):
     with BookingDatabaseUtils() as db:
         db.setBookingOngoing(bookingID, ongoing)
Exemple #24
0
 def completeBooking(self, booking_id):
     with BookingDatabaseUtils() as db:
         db.updateStatus(1, booking_id)
Exemple #25
0
 def test_listAllBooking(self):
     with BookingDatabaseUtils(self.connection) as db:
         self.assertTrue(self.countBooking() == len(db.listAllBooking()))
Exemple #26
0
 def setBookingDuration(self, bookingID, duration):
     with BookingDatabaseUtils() as db:
         db.setBookingDuration(bookingID, duration)
Exemple #27
0
 def getLatestBookingID(self):
     with BookingDatabaseUtils() as db:
         for bookingID in db.getLatestBookingId():
             return int(bookingID[0])
Exemple #28
0
 def makeBooking(self, cust_id, car_id, start_date, start_time, end_date,
                 end_time, total_time, total_cost):
     with BookingDatabaseUtils() as db:
         db.insertBooking(cust_id, car_id, start_date, start_time, end_date,
                          end_time, total_time, total_cost, 0)