def test_get_filtered_comments_admins_can_access(self):
        self.site_2 = Site.objects.create()
        t1 = Thread.objects.create(site=self.site, url='test_url')
        t2 = Thread.objects.create(site=self.site_2, url='test_url_2')
        c1 = Comment.objects.create(thread=t1, hidden=True)
        c2 = Comment.objects.create(thread=t2, hidden=True)
        c3 = Comment.objects.create(thread=t2, hidden=True)

        self.client.login(email="donald@duck.com", password="password")
        self.admin.is_superuser = False
        self.admin.save()
        self.assertFalse(self.admin.get_comments())

        self.site.admins.add(self.admin)
        num_of_comments = self.admin.get_comments().count()
        self.assertEqual(num_of_comments, 1)
        self.assertEqual(
            self.admin.get_comments()[num_of_comments - 1].id, c1.id)

        self.site_2.admins.add(self.admin)
        num_of_comments = self.admin.get_comments().count()
        self.assertEqual(num_of_comments, 3)
        self.assertEqual(
            self.admin.get_comments()[num_of_comments - 3].id, c1.id)
        self.assertEqual(
            self.admin.get_comments()[num_of_comments - 2].id, c2.id)
        self.assertEqual(
            self.admin.get_comments()[num_of_comments - 1].id, c3.id)
dataset/ETHPy150Open c4all/c4all/admin/tests/thread.py/AdminThreadTestCases.test_get_filtered_comments_admins_can_access/original