-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1581] make help texts configurable via CMS
- Loading branch information
Showing
5 changed files
with
98 additions
and
36 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/open_inwoner/cms/extensions/migrations/0006_commonextension_help_text.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 3.2.15 on 2023-08-09 10:12 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("extensions", "0005_alter_commonextension_menu_icon"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="commonextension", | ||
name="help_text", | ||
field=models.TextField( | ||
blank=True, help_text="Help text for the page", verbose_name="Help text" | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from unittest.mock import patch | ||
|
||
from django.test import TestCase, override_settings | ||
from django.urls import reverse | ||
|
||
from pyquery import PyQuery | ||
|
||
from open_inwoner.accounts.tests.factories import UserFactory | ||
|
||
from ..inbox.cms_apps import InboxApphook | ||
from ..tests import cms_tools | ||
|
||
|
||
@override_settings(ROOT_URLCONF="open_inwoner.cms.tests.urls") | ||
class TestCMSHelpText(TestCase): | ||
def setUp(self): | ||
self.user = UserFactory() | ||
self.user.set_password("12345") | ||
self.user.email = "[email protected]" | ||
self.user.save() | ||
|
||
@patch("open_inwoner.configurations.models.SiteConfiguration.get_solo") | ||
def test_help_text(self, mock_solo): | ||
mock_solo.return_value.cookiebanner_enabled = False | ||
|
||
cms_tools.create_apphook_page( | ||
InboxApphook, | ||
extension_args={ | ||
"help_text": "Help! I need somebody. Help!", | ||
}, | ||
) | ||
|
||
url = reverse("inbox:index") | ||
self.client.login(email=self.user.email, password="12345") | ||
response = self.client.get(url) | ||
|
||
doc = PyQuery(response.content.decode("utf-8")) | ||
|
||
modal = doc.find(".help-modal")[0] | ||
self.assertEqual(modal.attrib["data-help-text"], "Help! I need somebody. Help!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters