Skip to content

Commit 677cf7e

Browse files
committed
Add render test
1 parent 4a6072f commit 677cf7e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_autocomponent.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from cms.api import add_plugin
12
from cms.test_utils.testcases import CMSTestCase
23

34
from tests.fixtures import TestFixture
@@ -21,3 +22,21 @@ def test_autocomponents_are_auto_detected(self):
2122
self.assertIn("config", form.base_fields) # Inherited from djangocms_frontend.models.FrontendUIItem
2223

2324
self.assertTrue(plugin.allow_children)
25+
26+
def test_render_autocomponent(self):
27+
add_plugin(
28+
placeholder=self.placeholder,
29+
plugin_type="AutoHeroPlugin",
30+
language=self.language,
31+
config={"title": "My Hero", "slogan": "My Hero Slogan", "hero_image": None},
32+
)
33+
self.publish(self.page, self.language)
34+
35+
with self.login_user_context(self.superuser):
36+
response = self.client.get(self.request_url)
37+
self.assertEqual(response.status_code, 200)
38+
39+
# Declarative tags render empty
40+
self.assertContains(response, 9 * "\n" + '<section class="bg-white dark:bg-gray-900">')
41+
self.assertContains(response, "My Hero")
42+
self.assertContains(response, "My Hero Slogan")

0 commit comments

Comments
 (0)