<commit_before>from __future__ import absolute_import, unicode_literals

import unittest

from wagtaildraftail.wagtail_hooks import draftail_editor_css, draftail_editor_js


class TestWagtailHooks(unittest.TestCase):
    def test_editor_css(self):
        self.assertEqual(
            draftail_editor_css(), '<link rel="stylesheet" href="/static/wagtaildraftail/wagtaildraftail.css">')

    def test_editor_js(self):
        self.assertEqual(
            draftail_editor_js(), '<script src="/static/wagtaildraftail/wagtaildraftail.js"></script>')<commit_msg>Add wagtail_hooks tests<commit_after>from __future__ import absolute_import, unicode_literals

import unittest

from wagtail.wagtailcore.hooks import get_hooks

from wagtaildraftail.wagtail_hooks import draftail_editor_css, draftail_editor_js


class TestWagtailHooks(unittest.TestCase):
    def test_editor_css(self):
        self.assertEqual(
            draftail_editor_css(), '<link rel="stylesheet" href="/static/wagtaildraftail/wagtaildraftail.css">')

    def test_insert_editor_css_hook(self):
        hooks = get_hooks('insert_editor_css')
        self.assertIn(draftail_editor_css, hooks, 'Editor CSS should be inserted automatically.')

    def test_editor_js(self):
        self.assertEqual(
            draftail_editor_js(), '<script src="/static/wagtaildraftail/wagtaildraftail.js"></script>')

    def test_insert_editor_js(self):
        hooks = get_hooks('insert_editor_js')
        self.assertIn(draftail_editor_js, hooks, 'Editor JS should be inserted automatically.')
{'fraction_non_alphanumeric': 0.0944372574385511, 'fraction_numerical': 0.0, 'mean_word_length': 4.815789473684211, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7631030', 'n_tokens_mistral': 476, 'n_tokens_neox': 476, 'n_words': 83}