Exemple #1
0
    def test_reservations_are_returned_only_for_the_specified_book(self):
        create_reservation(book=self.book2, reserver=self.reserver.libraryuser)

        reservation = create_reservation(book=self.book1,
                                         reserver=self.reserver.libraryuser)
        reservations = self.book1.reservations()

        self.assertEqual(list(reservations), [reservation])
Exemple #2
0
    def test_library_user_reservation_queue_position_is_2_if_makes_second_reservation(
            self):
        other_user = create_other_user()

        create_reservation(book=self.book, reserver=other_user.libraryuser)
        create_reservation(book=self.book, reserver=self.user.libraryuser)

        self.assertEqual(
            self.user.libraryuser.reservation_queue_position(self.book), 2)
Exemple #3
0
 def setUp(self):
     self.book = create_book("test-book", "")
     self.reservation = create_reservation(book=self.book,
                                           reserver=self.user.libraryuser)
Exemple #4
0
    def test_library_user_reservation_queue_position_is_1_if_only_one_in_queue(
            self):
        create_reservation(book=self.book, reserver=self.user.libraryuser)

        self.assertEqual(
            self.user.libraryuser.reservation_queue_position(self.book), 1)
Exemple #5
0
    def test_library_user_reservations_can_be_returned(self):
        reservation = create_reservation(book=self.book,
                                         reserver=self.user.libraryuser)

        self.assertEqual(list(self.user.libraryuser.reservations()),
                         [reservation])