def test_sort_by_estimation_category1(self):
        """
        Must generate correct dictionaries for anonymous users, users with private books and without.
        Testing returned book rating at first category.
        """
        self.assertTrue(isinstance(Book.sort_by_estimation(self.anonymous_user, self.category1), list))
        self.assertEqual(len(Book.sort_by_estimation(self.anonymous_user, self.category1)), 3)
        self.assertEqual(Book.sort_by_estimation(self.anonymous_user, self.category1)[0]['rating'], 7)
        self.assertEqual(Book.sort_by_estimation(self.anonymous_user, self.category1)[2]['rating'], 6)

        self.assertEqual(len(Book.sort_by_estimation(self.the_user2.id_user, self.category1)), 3)
        self.assertEqual(Book.sort_by_estimation(self.the_user2.id_user, self.category1)[0]['rating'], 7)
        self.assertEqual(Book.sort_by_estimation(self.the_user2.id_user, self.category1)[2]['rating'], 6)

        self.assertEqual(len(Book.sort_by_estimation(self.the_user1.id_user, self.category1)), 4)
        self.assertEqual(Book.sort_by_estimation(self.the_user1.id_user, self.category1)[0]['rating'], 7)
        self.assertEqual(Book.sort_by_estimation(self.the_user1.id_user, self.category1)[2]['rating'], 6)