Esempio n. 1
0
 def test_RentalSetters(self):
     r = Rental(1, 2, 3, "2017-10-20", "2017-11-20", "2018-01-20")
     r.id = 4
     r.movieId = 5
     r.clientId = 6
     r.returnedDate = "2017-12-20"
     r.dueDate = "2017-12-20"
     r.rentedDate = "2017-08-09"
     a = r.dueDate
     a = r.returnedDate
     self.assertNotEqual(
         r, Rental(4, 5, 6, "2017-12-20", "2017-12-20", "2017-08-09"))
     repo = Repository("testRentalsRental", "test")
     movieRepo = Repository("testRentalsMovie", "tes2")
     mc = MovieController(movieRepo)
     clientRepo = Repository("testRentalsClients", "test3")
     cc = ClientController(clientRepo)
     controller = RentalController(repo, cc, mc)
     self.assertEqual(controller.lateRentals(), [])
     self.assertEqual(controller.allRentedMovies(), mc.getAllMovies())
     s = mc.getAllMovies()
     self.assertEqual(controller.mostRentedMoviesByNumber(),
                      controller.mostRentedMoviesByNumber())
     self.assertEqual(controller.mostRentedMoviesByDays(),
                      controller.mostRentedMoviesByDays())
     self.assertRaises(ValueError, controller.updateClientIdFromRental, "s",
                       "2")
     self.assertRaises(ValueError, controller.updateClientIdFromRental, "2",
                       "s")
     controller.removeAllAppOfClient("1")
     controller.removeAllAppOfMovie("1")
     controller.updateMovieIdFromRental("1", "1")
     controller.updateClientIdFromRental("1", "1")
     self.assertRaises(ValueError, controller.updateClientIdFromRental, "2",
                       "s")
     self.assertRaises(ValueError, controller.updateClientIdFromRental, "s",
                       "2")
Esempio n. 2
0
 def test_GetAllMovies(self):
     repo2 = Repository('movieUpdateTest', "test2")
     movie = Movie("2", "223", '22320', 'action')
     controller2 = MovieController(repo2)
     l = controller2.getAllMovies()
     self.assertEqual(controller2.getAllMovies(), [movie])