Skip to content

Commit a314b92

Browse files
committed
feat: Add test to ensure carousel links are generated properly
1 parent e06ecc6 commit a314b92

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/carousel/test_plugins.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,28 @@ def test_carousel_slide_plugin(self):
104104
or ('<div class="carousel slide"' in response.content.decode("utf-8")),
105105
f'<div class="slide carousel" not found in {response.content.decode("utf-8")}',
106106
)
107+
108+
# Now testing if links are working
109+
row = add_plugin(
110+
placeholder=self.placeholder,
111+
plugin_type=CarouselPlugin.__name__,
112+
language=self.language,
113+
)
114+
row.initialize_from_form(CarouselForm).save()
115+
plugin = add_plugin(
116+
target=row,
117+
placeholder=self.placeholder,
118+
plugin_type=CarouselSlidePlugin.__name__,
119+
language=self.language,
120+
config=dict(
121+
carousel_image=dict(pk=self.image.id, model="filer.Image"),
122+
link=dict(external_link="https://www.divio.com"),
123+
),
124+
)
125+
plugin.initialize_from_form(CarouselSlideForm).save()
126+
self.publish(self.page, self.language)
127+
128+
with self.login_user_context(self.superuser):
129+
response = self.client.get(self.request_url)
130+
self.assertEqual(response.status_code, 200)
131+
self.assertContains(response, 'href="https://www.divio.com"')

0 commit comments

Comments
 (0)