def test_sort_by_author_category2(self):
        """
        Must generate correct dictionaries for anonymous users, users with private books and without.
        Testing returned book authors at second category.
        """
        escaped_author_name = '&lt;AuthorSpecialSymbols&gt;&amp;&quot;'

        self.assertEqual(len(Book.sort_by_author(self.anonymous_user, self.category2)), 2)
        self.assertEqual(Book.sort_by_author(self.anonymous_user, self.category2)[0]['author'], escaped_author_name)

        self.assertEqual(len(Book.sort_by_author(self.the_user2.id_user, self.category2)), 2)
        self.assertEqual(Book.sort_by_author(self.the_user2.id_user, self.category2)[0]['author'], escaped_author_name)

        self.assertEqual(len(Book.sort_by_author(self.the_user1.id_user, self.category2)), 3)
        self.assertEqual(Book.sort_by_author(self.the_user1.id_user, self.category2)[0]['author'], escaped_author_name)
        self.assertEqual(Book.sort_by_author(self.the_user1.id_user, self.category2)[1]['author'],
                         self.author1.author_name)