def test_list_apphooks(self): out = StringIO() apps = ["cms", "menus", "sekizai", "cms.test_utils.project.sampleapp"] with SettingsOverride(INSTALLED_APPS=apps): create_page('Hello Title', "nav_playground.html", "en", apphook=APPHOOK) self.assertEqual(Page.objects.filter(application_urls=APPHOOK).count(), 1) command = cms.Command() command.stdout = out command.handle("list", "apphooks", interactive=False) self.assertEqual(out.getvalue(), "SampleApp\n")
def test_uninstall_plugins_with_plugin(self): out = StringIO() apps = ["cms", "menus", "sekizai", "cms.test_utils.project.sampleapp"] with SettingsOverride(INSTALLED_APPS=apps): placeholder = Placeholder.objects.create(slot="test") add_plugin(placeholder, TextPlugin, "en", body="en body") self.assertEqual(CMSPlugin.objects.filter(plugin_type=PLUGIN).count(), 1) command = cms.Command() command.stdout = out command.handle("uninstall", "plugins", PLUGIN, interactive=False) self.assertEqual(out.getvalue(), "1 'TextPlugin' plugins uninstalled\n") self.assertEqual(CMSPlugin.objects.filter(plugin_type=PLUGIN).count(), 0)
def test_copy_from_non_existing_lang(self): """ If an existing title in the target language has plugins in a placeholder and the command is called with *force-copy*, the plugins are copied on top of the existing one """ site = 1 out = StringIO() command = cms.Command() command.stdout = out command.handle("copy-lang", "de", "fr", "verbose") text = out.getvalue() page_count = Page.objects.on_site(site).drafts().count() + 1 for idx in range(1, page_count): self.assertTrue(text.find("Skipping page page%d, language de not defined" % idx) > -1)
def test_html(self): nullout = StringIO() with TemporaryDirectory() as OUT_DIR: app = Sphinx( DOCS_DIR, DOCS_DIR, OUT_DIR, OUT_DIR, "html", warningiserror=True, status=nullout, ) try: app.build() except: print(nullout.getvalue()) raise
def test_uninstall_apphooks_without_apphook(self): out = StringIO() command = cms.Command() command.stdout = out command.handle("uninstall", "apphooks", APPHOOK, interactive=False) self.assertEqual(out.getvalue(), "no 'SampleApp' apphooks found\n")
def test_uninstall_plugins_without_plugin(self): out = StringIO() command = cms.Command() command.stdout = out command.handle("uninstall", "plugins", PLUGIN, interactive=False) self.assertEqual(out.getvalue(), "no 'TextPlugin' plugins found\n")