Exemple #1
0
    def test_late_rentals(self):
        repoR = Repository()
        repoC = Repository()
        repoM = Repository()
        undo_service = UndoService()
        service_client = ClientService(repoC, undo_service)
        service_client.init_list_clients()

        service_movie = MovieService(repoM, undo_service)
        service_movie.init_list_movies()

        service = RentalService(repoR, repoC, repoM, undo_service)
        service.init_list_rentals()

        statistics = StatisticsService(repoC, repoM, repoR)
        late_rentals = statistics.late_rentals()
        self.assertEqual(len(late_rentals), 7)
Exemple #2
0
    def test_most_rented_movies(self):
        repoR = Repository()
        repoC = Repository()
        repoM = Repository()
        undo_service = UndoService()
        service_client = ClientService(repoC, undo_service)
        service_client.init_list_clients()

        service_movie = MovieService(repoM, undo_service)
        service_movie.init_list_movies()

        service = RentalService(repoR, repoC, repoM, undo_service)
        service.init_list_rentals()

        statistics = StatisticsService(repoC, repoM, repoR)
        most_rented_list = statistics.most_rented_movies()
        most_rented_list = sorted(most_rented_list, key=lambda rental: rental.days, reverse=True)

        rental_days = most_rented_list[0]
        owner = service_movie.search_by_id(3)
        self.assertEqual(rental_days.owner, owner)
        self.assertEqual(rental_days.days, 56)
Exemple #3
0
 def test_init_list(self):
     repo = Repository()
     undo_service = UndoService()
     Cs = ClientService(repo, undo_service)
     Cs.init_list_clients()
     self.assertEqual(len(repo), 10)