import json
from django.test import TestCase


class PreviewResourceTestCase(TestCase):
    def test_get(self):
        response = self.client.get('/api/data/preview/',
            HTTP_ACCEPT='application/json')
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response['Content-Type'], 'application/json')
        self.assertEqual(json.loads(response.content), {
            '_links': {
                'self': {
                    'href': 'http://testserver/api/data/preview/?limit=20&page=1',
                },
                'base': {
                    'href': 'http://testserver/api/data/preview/',
                }
            },
            'keys': [],
            'object_count': 0,
            'object_name': 'employee',
            'object_name_plural': 'employees',
            'objects': [],
            'page_num': 1,
            'num_pages': 1,
            'limit': 20,
        })

@@ -5,16 +5,60 @@
 rt json%0A
+from django.contrib.auth.models import User%0A
 from dja
@@ -967,8 +967,1001 @@
      %7D)%0A
+%0A    def test_get_with_user(self):%0A        self.user = User.objects.create_user(username='test', password='test')%0A        self.client.login(username='test', password='test')%0A%0A        response = self.client.get('/api/data/preview/',%0A            HTTP_ACCEPT='application/json')%0A        self.assertEqual(response.status_code, 200)%0A        self.assertEqual(response%5B'Content-Type'%5D, 'application/json')%0A        self.assertEqual(json.loads(response.content), %7B%0A            '_links': %7B%0A                'self': %7B%0A                    'href': 'http://testserver/api/data/preview/?limit=20&page=1',%0A                %7D,%0A                'base': %7B%0A                    'href': 'http://testserver/api/data/preview/',%0A                %7D%0A            %7D,%0A            'keys': %5B%5D,%0A            'object_count': 0,%0A            'object_name': 'employee',%0A            'object_name_plural': 'employees',%0A            'objects': %5B%5D,%0A            'page_num': 1,%0A            'num_pages': 1,%0A            'limit': 20,%0A        %7D)%0A

Add test to recreate error in this bug