Skip to content
test_checks.py 40.7 KiB
Newer Older
        self.assertCheckMessages(
            ["relate_custom_page_types_removed_deadline.E001"])


class CheckRelateDisableCodehiliteMarkdownExtensions(CheckRelateSettingsBase):
Dong Zhuang's avatar
Dong Zhuang committed
    msg_id_prefix = "relate_disable_codehilite_markdown_extension"
    VALID_CONF = None
    VALID_CONF_NO_WARNING = True

    WARNING_CONF_NOT_BOOL1 = "some string"
    WARNING_CONF_NOT_BOOL2 = ["markdown.extensions.codehilite"]
    WARNING_CONF_FALSE = False

    @override_settings(RELATE_DISABLE_CODEHILITE_MARKDOWN_EXTENSION=VALID_CONF)
    def test_valid_conf(self):
Dong Zhuang's avatar
Dong Zhuang committed
        self.assertCheckMessages([])

    @override_settings(
        RELATE_DISABLE_CODEHILITE_MARKDOWN_EXTENSION=VALID_CONF_NO_WARNING)
    def test_valid_conf_no_warning(self):
Dong Zhuang's avatar
Dong Zhuang committed
        self.assertCheckMessages([])

    @override_settings(
        RELATE_DISABLE_CODEHILITE_MARKDOWN_EXTENSION=WARNING_CONF_NOT_BOOL1)
    def test_warning_conf_not_bool1(self):
Dong Zhuang's avatar
Dong Zhuang committed
        self.assertCheckMessages(
            ["relate_disable_codehilite_markdown_extension.W001"])

    @override_settings(
        RELATE_DISABLE_CODEHILITE_MARKDOWN_EXTENSION=WARNING_CONF_NOT_BOOL2)
    def test_warning_conf_not_bool2(self):
Dong Zhuang's avatar
Dong Zhuang committed
        self.assertCheckMessages(
            ["relate_disable_codehilite_markdown_extension.W001"])

    @override_settings(
        RELATE_DISABLE_CODEHILITE_MARKDOWN_EXTENSION=WARNING_CONF_FALSE)
    def test_warning_conf_false(self):
Dong Zhuang's avatar
Dong Zhuang committed
        self.assertCheckMessages(
            ["relate_disable_codehilite_markdown_extension.W002"])