Skip to content

Commit

Permalink
add missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk committed Mar 14, 2024
1 parent 90c2a81 commit 938bf47
Show file tree
Hide file tree
Showing 4 changed files with 277 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2020-10-08 14:24+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0\n"
"Language-Code: en\n"
"Language-Name: English\n"
"Preferred-Encodings: utf-8 latin1\n"
"Domain: DOMAIN\n"

#: redturtle/voltoplugin/editablefooter/profiles/default/controlpanel.xml
msgid "Editable footer settings"
msgstr ""

#: redturtle/voltoplugin/editablefooter/configure.zcml:28
msgid "Installs the redturtle.voltoplugin.editablefooter add-on."
msgstr ""

#: redturtle/voltoplugin/editablefooter/configure.zcml:37
msgid "Uninstalls the redturtle.voltoplugin.editablefooter add-on."
msgstr ""

#. Default: "Set infos for columns in footer."
#: redturtle/voltoplugin/editablefooter/browser/controlpanel.py:13
msgid "editable_footer_settings_help"
msgstr ""

#. Default: "Editable Footer Settings"
#: redturtle/voltoplugin/editablefooter/browser/controlpanel.py:10
msgid "editable_footer_settings_label"
msgstr ""

#. Default: "Set a list of custom columns for the footer. You can have different sets for each portal's languages."
#: redturtle/voltoplugin/editablefooter/interfaces.py:15
msgid "footer_columns_help"
msgstr ""

#. Default: "Footer columns"
#: redturtle/voltoplugin/editablefooter/interfaces.py:14
msgid "footer_columns_label"
msgstr ""

#: redturtle/voltoplugin/editablefooter/configure.zcml:28
msgid "redturtle.voltoplugin.editablefooter"
msgstr ""

#: redturtle/voltoplugin/editablefooter/configure.zcml:37
msgid "redturtle.voltoplugin.editablefooter (uninstall)"
msgstr ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2020-10-08 14:24+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0\n"
"Language-Code: it\n"
"Language-Name: Italian\n"
"Preferred-Encodings: utf-8 latin1\n"
"Domain: DOMAIN\n"

#: redturtle/voltoplugin/editablefooter/profiles/default/controlpanel.xml
msgid "Editable footer settings"
msgstr "Impostazioni footer"

#: redturtle/voltoplugin/editablefooter/configure.zcml:28
msgid "Installs the redturtle.voltoplugin.editablefooter add-on."
msgstr "Installa redturtle.voltoplugin.editablefooter"

#: redturtle/voltoplugin/editablefooter/configure.zcml:37
msgid "Uninstalls the redturtle.voltoplugin.editablefooter add-on."
msgstr "Disinstalla redturtle.voltoplugin.editablefooter"

#. Default: "Set infos for columns in footer."
#: redturtle/voltoplugin/editablefooter/browser/controlpanel.py:13
msgid "editable_footer_settings_help"
msgstr "Imposta i dati per le colonne del footer."

#. Default: "Editable Footer Settings"
#: redturtle/voltoplugin/editablefooter/browser/controlpanel.py:10
msgid "editable_footer_settings_label"
msgstr "Impostazioni footer"

#. Default: "Set a list of custom columns for the footer. You can have different sets for each portal's languages."
#: redturtle/voltoplugin/editablefooter/interfaces.py:15
msgid "footer_columns_help"
msgstr "Configura una serie di colonne per il footer. Puoi creare differenti impostazioni per le varie lingue del sito."

#. Default: "Footer columns"
#: redturtle/voltoplugin/editablefooter/interfaces.py:14
msgid "footer_columns_label"
msgstr "Colonne footer"

#: redturtle/voltoplugin/editablefooter/configure.zcml:28
msgid "redturtle.voltoplugin.editablefooter"
msgstr ""

#: redturtle/voltoplugin/editablefooter/configure.zcml:37
msgid "redturtle.voltoplugin.editablefooter (uninstall)"
msgstr ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# --- PLEASE EDIT THE LINES BELOW CORRECTLY ---
# SOME DESCRIPTIVE TITLE.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2020-10-08 14:24+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0\n"
"Language-Code: en\n"
"Language-Name: English\n"
"Preferred-Encodings: utf-8 latin1\n"
"Domain: redturtle.voltoplugin.editablefooter\n"

#: redturtle/voltoplugin/editablefooter/profiles/default/controlpanel.xml
msgid "Editable footer settings"
msgstr ""

#: redturtle/voltoplugin/editablefooter/configure.zcml:28
msgid "Installs the redturtle.voltoplugin.editablefooter add-on."
msgstr ""

#: redturtle/voltoplugin/editablefooter/configure.zcml:37
msgid "Uninstalls the redturtle.voltoplugin.editablefooter add-on."
msgstr ""

#. Default: "Set infos for columns in footer."
#: redturtle/voltoplugin/editablefooter/browser/controlpanel.py:13
msgid "editable_footer_settings_help"
msgstr ""

#. Default: "Editable Footer Settings"
#: redturtle/voltoplugin/editablefooter/browser/controlpanel.py:10
msgid "editable_footer_settings_label"
msgstr ""

#. Default: "Set a list of custom columns for the footer. You can have different sets for each portal's languages."
#: redturtle/voltoplugin/editablefooter/interfaces.py:15
msgid "footer_columns_help"
msgstr ""

#. Default: "Footer columns"
#: redturtle/voltoplugin/editablefooter/interfaces.py:14
msgid "footer_columns_label"
msgstr ""

#: redturtle/voltoplugin/editablefooter/configure.zcml:28
msgid "redturtle.voltoplugin.editablefooter"
msgstr ""

#: redturtle/voltoplugin/editablefooter/configure.zcml:37
msgid "redturtle.voltoplugin.editablefooter (uninstall)"
msgstr ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# -*- coding: utf-8 -*-
from plone import api
from plone.app.testing import applyProfile
from plone.app.testing import setRoles
from plone.app.testing import SITE_OWNER_NAME
from plone.app.testing import SITE_OWNER_PASSWORD
from plone.app.testing import TEST_USER_ID
from plone.registry.interfaces import IRegistry
from plone.restapi.testing import RelativeSession
from redturtle.voltoplugin.editablefooter.interfaces import IEditableFooterSettings
from redturtle.voltoplugin.editablefooter.testing import (
VOLTO_EDITABLEFOOTER_API_FUNCTIONAL_TESTING,
)
from transaction import commit
from zope.component import getUtility


import json
import unittest


class FooterColumnsEndpointTest(unittest.TestCase):
layer = VOLTO_EDITABLEFOOTER_API_FUNCTIONAL_TESTING

def setUp(self):
self.app = self.layer["app"]
self.portal = self.layer["portal"]
self.request = self.layer["request"]
self.portal_url = self.portal.absolute_url()
self.controlpanel_url = "/@controlpanels/editable-footer-settings"
setRoles(self.portal, TEST_USER_ID, ["Manager"])

self.api_session = RelativeSession(self.portal_url)
self.api_session.headers.update({"Accept": "application/json"})
self.api_session.auth = (SITE_OWNER_NAME, SITE_OWNER_PASSWORD)

self.value = [
{
"items": [
{"text": {"data": '<a href="https://site.com/">Link 1</a>'}},
{"text": {"data": '<a href="/relative/to/this/site">Link 1</a>'}},
]
}
]
self.set_record_value(field="footer_columns", value=json.dumps(self.value))

def tearDown(self):
self.api_session.close()

def set_record_value(self, field, value):
api.portal.set_registry_record(field, value, interface=IEditableFooterSettings)
commit()

def test_route_exists(self):
response = self.api_session.get("/@footer-columns")
self.assertEqual(response.status_code, 200)
self.assertEqual(response.headers.get("Content-Type"), "application/json")

def test_return_json_data(self):
response = self.api_session.get("/@footer-columns")
self.assertEqual(response.status_code, 200)
result = response.json()
# self.value has relative links, but the result should have absolute links
self.assertNotEqual(result, self.value)
self.assertEqual(
json.dumps(result),
json.dumps(self.value).replace('href=\\"/', f'href=\\"{self.portal_url}/'),
)


class FooterColumnsEndpointTestWithPloneVolto(FooterColumnsEndpointTest):
layer = VOLTO_EDITABLEFOOTER_API_FUNCTIONAL_TESTING

def setUp(self):
super().setUp()
applyProfile(self.portal, "plone.volto:default")

def test_return_json_data_with_portal_url_if_plone_volto_installed_and_not_configured(
self,
):
response = self.api_session.get("/@footer-columns")
self.assertEqual(response.status_code, 200)
result = response.json()
# self.value has relative links, but the result should have absolute links
self.assertNotEqual(result, self.value)
self.assertEqual(
json.dumps(result),
json.dumps(self.value).replace('href=\\"/', f'href=\\"{self.portal_url}/'),
)

def test_return_json_data_with_frontend_domain_if_set(self):
from plone.volto.interfaces import IVoltoSettings

registry = getUtility(IRegistry)
settings = registry.forInterface(IVoltoSettings, prefix="volto", check=False)
settings.frontend_domain = "http://foo.org"
commit()

response = self.api_session.get("/@footer-columns")
self.assertEqual(response.status_code, 200)
result = response.json()
# self.value has relative links, but the result should have absolute links
self.assertNotEqual(result, self.value)
self.assertEqual(
json.dumps(result),
json.dumps(self.value).replace(
'href=\\"/', f'href=\\"{settings.frontend_domain}/'
),
)

0 comments on commit 938bf47

Please sign in to comment.