from io import StringIO

from django.apps import apps
from django.core.management import call_command
from django.test import TestCase

from .models import ContentPage


class ContentPageTestCase(TestCase):
    def test_creatable(self):
        """ContentPage should be creatable."""
        self.assertTrue(ContentPage.is_creatable)

    def test_django_checks_pass(self):
        call_command("check", stdout=StringIO())

    def test_required_wagtail_integration_apps_are_installed(self):
        self.assertTrue(apps.is_installed("ocyan.plugin.wagtail"))
        self.assertTrue(apps.is_installed("ocyan.plugin.wagtail_i18n"))
