def test_sort_by_estimation_category2(self):
        """
        Must generate correct dictionaries for anonymous users, users with private books and without.
        Testing returned book rating at second category.
        """
        self.assertEqual(len(Book.sort_by_estimation(self.anonymous_user, self.category2)), 2)
        self.assertEqual(Book.sort_by_estimation(self.anonymous_user, self.category2)[0]['rating'], 4)

        self.assertEqual(len(Book.sort_by_estimation(self.the_user2.id_user, self.category2)), 2)
        self.assertEqual(Book.sort_by_estimation(self.the_user2.id_user, self.category2)[0]['rating'], 4)

        self.assertEqual(len(Book.sort_by_estimation(self.the_user1.id_user, self.category2)), 3)
        self.assertEqual(Book.sort_by_estimation(self.the_user1.id_user, self.category2)[0]['rating'], 4)
        self.assertEqual(Book.sort_by_estimation(self.the_user1.id_user, self.category2)[1]['rating'], None)