summaryrefslogtreecommitdiffstats
path: root/tests/test_pages.py
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2017-10-13 08:34:02 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2017-10-13 12:46:53 (GMT)
commit34f6fc985bd005586276e1a8720579b6ca538682 (patch)
tree6d0da1de9f62245734e54ccabd598b14ddecba4a /tests/test_pages.py
parentc4af7f71050a03526cb699545f6572a348bca69b (diff)
downloadcombo-34f6fc985bd005586276e1a8720579b6ca538682.zip
combo-34f6fc985bd005586276e1a8720579b6ca538682.tar.gz
combo-34f6fc985bd005586276e1a8720579b6ca538682.tar.bz2
general: extract placeholder details from templates instead of settings (#18925)
Diffstat (limited to 'tests/test_pages.py')
-rw-r--r--tests/test_pages.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_pages.py b/tests/test_pages.py
index 0d076b3..0e584ff 100644
--- a/tests/test_pages.py
+++ b/tests/test_pages.py
@@ -6,6 +6,7 @@ import sys
from django.conf import settings
from django.contrib.auth.models import User, Group
+from django.test import override_settings
from django.utils.timezone import now
from combo.data.models import Page, CellBase, TextCell, LinkCell
from combo.data.management.commands.import_site import Command as ImportSiteCommand
@@ -262,3 +263,25 @@ def test_last_update_time():
TextCell.objects.filter(pk=cell.id).update(last_update_timestamp=future_time)
assert page.get_last_update_time() == future_time
+
+def test_get_placeholders():
+ page = Page(title=u'foo', slug='foo', template_name='standard-sidebar', order=0)
+ placeholders = page.get_placeholders()
+ assert [x.key for x in placeholders] == ['content', 'sidebar', 'footer']
+ assert placeholders[0].acquired is False
+ assert placeholders[-1].acquired is True
+
+ with override_settings(COMBO_PUBLIC_TEMPLATES={
+ 'standard-sidebar': {
+ 'name': 'Test',
+ 'template': 'combo/page_template_sidebar.html',
+ 'placeholders': {
+ 'content': {'name': 'Content'},
+ 'content2': {'name': 'Second Content'},
+ 'sidebar': {'name': 'Sidebar'},
+ 'footer': {'name': 'Footer', 'acquired': False},
+ }}}):
+ placeholders = page.get_placeholders()
+ assert set([x.key for x in placeholders]) == set(['content', 'content2', 'sidebar', 'footer'])
+ footer_placeholder = [x for x in placeholders if x.key == 'footer'][0]
+ assert footer_placeholder.acquired is False