def test_get_by_user_with_user_permission(self):
        user = User.objects.create(username='john_doe')
        site = Site.objects.all()[0]
        channel = Channel.objects.create(
            name='Home',
            slug='home',
            site=site,
            user=user
        )
        permission = Permission.objects.create(user=user)
        permission.channel.add(channel)
        permission.save()

        result = Permission.get_by_user(user)

        self.assertTrue(site.pk in result['all_sites_id'])
        self.assertTrue(channel.pk in result['channels_id'])
dataset/ETHPy150Open opps/opps/tests/core/permissions/test_models.py/PermissionModelTest.test_get_by_user_with_user_permission/original