<commit_before>
import json
from tests.test_base import BaseTestCase
from tests.mock.factories import PDFFormFactory
from flask import url_for
from src.main import db
from src.pdfhook.serializers import (
    PDFFormIndexDumper, PDFFormDumper
    )


class TestViews(BaseTestCase):

    def setUp(self):
        BaseTestCase.setUp(self)
        self.pdfs = [PDFFormFactory.create() for i in range(3)]
        db.session.commit()

    def test_index_view_returns_html(self):
        response = self.client.get(
            url_for('pdfhook.index')
            )
        self.assertIn(
            '<h4 class="text-center">Upload a PDF Form to Try It Out</h4>',
            response.data.decode('utf-8')
        )

    def test_index_get_accept_json_returns_json_index_of_forms(self):
        dumper = PDFFormIndexDumper()
        sorted_pdfs = sorted(self.pdfs,
            key=lambda p: p.latest_post,<commit_msg>fix a poorly written test<commit_after>
import json
from tests.test_base import BaseTestCase
from tests.mock.factories import PDFFormFactory
from flask import url_for
from src.main import db
from src.pdfhook.serializers import (
    PDFFormIndexDumper, PDFFormDumper
    )


class TestViews(BaseTestCase):

    def setUp(self):
        BaseTestCase.setUp(self)
        self.pdfs = [PDFFormFactory.create() for i in range(3)]
        db.session.commit()

    def test_index_view_returns_html(self):
        response = self.client.get(
            url_for('pdfhook.index')
            )
        self.assertIn(
            'Upload a PDF Form to Try It Out',
            response.data.decode('utf-8')
        )

    def test_index_get_accept_json_returns_json_index_of_forms(self):
        dumper = PDFFormIndexDumper()
        sorted_pdfs = sorted(self.pdfs,
            key=lambda p: p.latest_post,
{'fraction_non_alphanumeric': 0.08678828081813156, 'fraction_numerical': 0.003316749585406302, 'mean_word_length': 2.7708333333333335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4205429', 'n_tokens_mistral': 566, 'n_tokens_neox': 559, 'n_words': 124}