def test_user_can_reserve_maximum_of_three_books(self): books = [ self.book, create_book('test_book_2'), create_book('test_book_3'), create_book('test_book_4') ] for book in books: self.__post_reservation_create(book.id) messages = list(get_messages(self.response.wsgi_request)) self.assertEqual(Reservation.objects.count(), 3) self.assertEqual(str(messages[0]), 'You have reserved maximum number of books.')
def test_with_objects(self): book = create_book('test', 'test', borrowings_count=1) create_author('test', 'test') create_genre('test') self.__get_response() self.__assert_context(1, 1, 1, [book], [book])
def test_detail_with_logged_in_user(self): book = create_book('test', 'test') self.login() self.__get_detail_response(book.id) self.assertEqual(self.response.context['book'], book) self.assertEqual(self.response.context['reservation_queue_position'], 0) self.assertEqual(self.response.status_code, 200)
def setUp(self): self.book = create_book('test_book') self.login()
def setUp(self): self.book = create_book("test-book", "") self.borrowing = create_borrowing('1970-01-01', book=self.book, borrower=self.user.libraryuser)
def test_detail_with_valid_id(self): book = create_book('test', 'test') self.__get_detail_response(book.id) self.assertEqual(self.response.context['book'], book) self.assertEqual(self.response.status_code, 200)
def test_list_with_a_book(self): book = create_book('test', 'test') self.__get_list_response() self.assertIn(book, self.response.context['books']) self.assertEqual(self.response.status_code, 200)
def setUp(self): self.book = create_book("test-book", "") self.reservation = create_reservation(book=self.book, reserver=self.user.libraryuser)
def setUp(self): self.book = create_book("test-book", "")
def setUp(self): self.book1 = create_book("test-book-1", borrowings_count=2) self.book2 = create_book("test-book-2", borrowings_count=0) self.book3 = create_book("test-book-3", borrowings_count=1)
def setUp(self): self.book1 = create_book("test-book-1", "") self.book2 = create_book("test-book-2", "") self.reserver = User.objects.create_user('test-user')