<commit_before>from django.utils import unittest
from django.test.client import RequestFactory


from djadmin2 import apiviews
from ..models import Post


class ViewTest(unittest.TestCase):
    def setUp(self):
        self.factory = RequestFactory()


class IndexViewModelListCreateAPIViewTest(ViewTest):
    def test_response_ok(self):
        request = self.factory.get('/admin/api/blog/post/')
        response = apiviews.ModelListCreateAPIView.as_view(model=Post)(request)
        self.assertEqual(response.status_code, 200)<commit_msg>Added test for unicode field in rest api<commit_after>from django.utils import unittest
from django.test.client import RequestFactory


from djadmin2 import apiviews
from ..models import Post


class ViewTest(unittest.TestCase):
    def setUp(self):
        self.factory = RequestFactory()


class IndexViewModelListCreateAPIViewTest(ViewTest):

    def test_response_ok(self):
        request = self.factory.get('/admin/api/blog/post/')
        response = apiviews.ModelListCreateAPIView.as_view(model=Post)(request)
        self.assertEqual(response.status_code, 200)

    def test_list_includes_unicode_field(self):
        Post.objects.create(title='Foo', body='Bar')
        request = self.factory.get('/admin/api/blog/post/')
        response = apiviews.ModelListCreateAPIView.as_view(model=Post)(request)
        response.render()

        self.assertIn('"unicode": "Foo"', response.content)
{'fraction_non_alphanumeric': 0.103544127866574, 'fraction_numerical': 0.005559416261292564, 'mean_word_length': 4.161290322580645, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1347563', 'n_tokens_mistral': 437, 'n_tokens_neox': 413, 'n_words': 82}