<commit_before>from django.test import TestCase

# Create your tests here.<commit_msg>Add base test for wiki. fix #38<commit_after>from django.test import TestCase
from django.urls import reverse
from .models import Page


# Create your tests here.
class PostModelTest(TestCase):

    def test_render_markdown(self):
        p = Page(content='aa')
        self.assertEqual(p.content_html, '<p>aa</p>\n')
        p = Page(content='[[aa|bb]]')
        self.assertTrue('href="bb"' in p.content_html)


class PostViewTest(TestCase):

    def test_post_view(self):
        p = Page(
            slug='first-blog',
            title='First blog',
            content='I am hhb',
        )
        p.save()
        url = reverse('wiki:page', args=(p.slug,))
        resp = self.client.get(url)
        self.assertContains(resp, 'I am hhb')
{'fraction_non_alphanumeric': 0.1310096153846154, 'fraction_numerical': 0.002403846153846154, 'mean_word_length': 2.7522522522522523, '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': '1300001', 'n_tokens_mistral': 262, 'n_tokens_neox': 254, 'n_words': 64}