diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml
new file mode 100644
index 0000000..d2573b6
--- /dev/null
+++ b/.github/workflows/black.yml
@@ -0,0 +1,35 @@
+name: Black
+on: [push]
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version: [3.8]
+
+ steps:
+ # git checkout
+ - uses: actions/checkout@v2
+
+ # python setup
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v1
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ # python cache
+ - uses: actions/cache@v1
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
+ restore-keys: |
+ ${{ runner.os }}-pip-
+
+ # install black
+ - name: install black
+ run: pip install black==21.12b0 click==8.0.4
+
+ # run black
+ - name: run black
+ run: black src/ --check --diff
diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml
new file mode 100644
index 0000000..97c7dfa
--- /dev/null
+++ b/.github/workflows/flake8.yml
@@ -0,0 +1,35 @@
+name: Flake8
+on: [push]
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version: [3.8]
+
+ steps:
+ # git checkout
+ - uses: actions/checkout@v2
+
+ # python setup
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v1
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ # python cache
+ - uses: actions/cache@v1
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
+ restore-keys: |
+ ${{ runner.os }}-pip-
+
+ # install flake8
+ - name: install flake8
+ run: pip install flake8
+
+ # run black
+ - name: run flake8
+ run: flake8 src/ setup.py
diff --git a/.github/workflows/pyroma.yml b/.github/workflows/pyroma.yml
new file mode 100644
index 0000000..bbad3c2
--- /dev/null
+++ b/.github/workflows/pyroma.yml
@@ -0,0 +1,35 @@
+name: Pyroma
+on: [push]
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version: [3.8]
+
+ steps:
+ # git checkout
+ - uses: actions/checkout@v2
+
+ # python setup
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v1
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ # python cache
+ - uses: actions/cache@v1
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
+ restore-keys: |
+ ${{ runner.os }}-pip-
+
+ # install pyroma
+ - name: install pyroma
+ run: pip install pyroma
+
+ # run pyroma
+ - name: run pyroma
+ run: pyroma -n 10 -d .
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 0f47093..cc4f5c2 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -1,27 +1,32 @@
name: Tests
-on: [push]
-
+on:
+ push:
+ paths-ignore:
+ - "**.md"
+ - "**.rst"
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
- python: ["3.7"]
- plone: ["52"]
- # exclude:
- # - python: "3.7"
- # plone: "51"
+ python: ["3.8", "3.9", "3.10", "3.11"]
+ plone: ["52", "60"]
+ exclude:
+ - python: "3.10"
+ plone: "52"
+ - python: "3.11"
+ plone: "52"
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
- name: Cache eggs
- uses: actions/cache@v1
+ uses: actions/cache@v3
with:
path: eggs
key: ${{ runner.OS }}-build-python${{ matrix.python }}-${{ matrix.plone }}
- name: Set up Python ${{ matrix.python }}
- uses: actions/setup-python@v1
+ uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
@@ -30,10 +35,32 @@ jobs:
cp test_plone${{ matrix.plone }}.cfg buildout.cfg
- name: Install buildout
run: |
- buildout -N -t 3 code-analysis:return-status-codes=True
+ buildout -N code-analysis:return-status-codes=True
- name: Code analysis
run: |
bin/code-analysis
- name: Run tests
run: |
- bin/test
+ bin/test-coverage
+ env:
+ PROXY_BEARER_AUTH: on
+ TZ: ${{ matrix.tz }}
+ - name: Upload coverage data to coveralls.io
+ run: |
+ pip install coveralls
+ coveralls --service=github
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ COVERALLS_FLAG_NAME: py${{ matrix.python }}-plone${{ matrix.plone }}-tz${{ matrix.tz }}
+ COVERALLS_PARALLEL: true
+
+ coveralls_finish:
+ needs: build
+ runs-on: ubuntu-latest
+ steps:
+ - name: Finished
+ run: |
+ pip install --upgrade coveralls
+ coveralls --service=github --finish
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/zpretty.yml b/.github/workflows/zpretty.yml
new file mode 100644
index 0000000..180f0e9
--- /dev/null
+++ b/.github/workflows/zpretty.yml
@@ -0,0 +1,40 @@
+name: zpretty
+on: [push]
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version: [3.8]
+
+ steps:
+ # git checkout
+ - uses: actions/checkout@v2
+
+ # python setup
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v1
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ # python cache
+ - uses: actions/cache@v1
+ with:
+ path: ~/.cache/pip
+ key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
+ restore-keys: |
+ ${{ runner.os }}-pip-
+
+ # install zpretty
+ - name: install zpretty
+ run: pip install zpretty
+
+ # run zpretty
+ - name: run zpretty
+ run: find src -name '*.zcml' | xargs zpretty -i
+
+ # XXX: this doesn't work on gh actions (https://github.com/plone/plone.restapi/pull/1119/checks?check_run_id=2686474411)
+ # run git diff
+ - name: run git diff
+ run: git diff --exit-code
diff --git a/.gitignore b/.gitignore
index 2318de2..a61569d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,6 +31,7 @@ report.html
.vscode/
.tox/
reports/
+pyvenv.cfg
# excludes
!.coveragerc
!.editorconfig
diff --git a/CHANGES.rst b/CHANGES.rst
index 99207e0..64739c0 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -5,7 +5,8 @@ Changelog
1.1.3 (unreleased)
------------------
-- Nothing changed yet.
+- absolut-ize urls
+ [mamico]
1.1.2 (2023-03-17)
diff --git a/base.cfg b/base.cfg
index ce20b0f..699d188 100644
--- a/base.cfg
+++ b/base.cfg
@@ -9,16 +9,17 @@ parts =
instance
test
code-analysis
- coverage
- test-coverage
- createcoverage
releaser
i18ndude
omelette
- robot
plone-helper-scripts
-develop = .
+ zpretty
+ zpretty-run
+ createcoverage
+ coverage
+ test-coverage
+develop = .
[instance]
recipe = plone.recipe.zope2instance
@@ -31,7 +32,7 @@ eggs =
Pillow
redturtle.voltoplugin.editablefooter [test]
-zcml-additional +=
+zcml-additional =
= 1.8.4",
"plone.restapi",
"plone.app.dexterity",
+ "plone.volto",
],
extras_require={
"test": [
diff --git a/src/redturtle/voltoplugin/editablefooter/browser/configure.zcml b/src/redturtle/voltoplugin/editablefooter/browser/configure.zcml
index 394259b..af01780 100644
--- a/src/redturtle/voltoplugin/editablefooter/browser/configure.zcml
+++ b/src/redturtle/voltoplugin/editablefooter/browser/configure.zcml
@@ -2,14 +2,15 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:plone="http://namespaces.plone.org/plone"
- i18n_domain="redturtle.voltoplugin.editablefooter">
+ i18n_domain="redturtle.voltoplugin.editablefooter"
+ >
+ layer="redturtle.voltoplugin.editablefooter.interfaces.IRedturtleVoltoEditablefooterLayer"
+ />
diff --git a/src/redturtle/voltoplugin/editablefooter/browser/controlpanel.py b/src/redturtle/voltoplugin/editablefooter/browser/controlpanel.py
index a33299f..7e886a3 100644
--- a/src/redturtle/voltoplugin/editablefooter/browser/controlpanel.py
+++ b/src/redturtle/voltoplugin/editablefooter/browser/controlpanel.py
@@ -7,11 +7,8 @@
class EditableFooterForm(controlpanel.RegistryEditForm):
-
schema = IEditableFooterSettings
- label = _(
- "editable_footer_settings_label", default="Editable Footer Settings"
- )
+ label = _("editable_footer_settings_label", default="Editable Footer Settings")
description = _(
"editable_footer_settings_help",
default="Set infos for columns in footer.",
diff --git a/src/redturtle/voltoplugin/editablefooter/configure.zcml b/src/redturtle/voltoplugin/editablefooter/configure.zcml
index 7b9e1fc..758fbc4 100644
--- a/src/redturtle/voltoplugin/editablefooter/configure.zcml
+++ b/src/redturtle/voltoplugin/editablefooter/configure.zcml
@@ -3,7 +3,8 @@
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:plone="http://namespaces.plone.org/plone"
- i18n_domain="redturtle.voltoplugin.editablefooter">
+ i18n_domain="redturtle.voltoplugin.editablefooter"
+ >
@@ -15,24 +16,24 @@
-
+
diff --git a/src/redturtle/voltoplugin/editablefooter/permissions.zcml b/src/redturtle/voltoplugin/editablefooter/permissions.zcml
index 1f79c8a..74de0f4 100644
--- a/src/redturtle/voltoplugin/editablefooter/permissions.zcml
+++ b/src/redturtle/voltoplugin/editablefooter/permissions.zcml
@@ -1,10 +1,11 @@
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ i18n_domain="plone"
+ >
-
+
diff --git a/src/redturtle/voltoplugin/editablefooter/restapi/configure.zcml b/src/redturtle/voltoplugin/editablefooter/restapi/configure.zcml
index e04f9dc..07b360c 100644
--- a/src/redturtle/voltoplugin/editablefooter/restapi/configure.zcml
+++ b/src/redturtle/voltoplugin/editablefooter/restapi/configure.zcml
@@ -1,31 +1,36 @@
+ xmlns:plone="http://namespaces.plone.org/plone"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ >
+
+
-
-
-
+
+ factory=".controlpanel.EditableFooterControlpanel"
+ provides="redturtle.voltoplugin.editablefooter.interfaces.IEditableFooterSettings"
+ name="editable-footer-settings"
+ />
+ method="GET"
+ factory=".get.FooterColumns"
+ for="Products.CMFCore.interfaces.ISiteRoot"
+ permission="zope2.View"
+ name="@footer-columns"
+ />
-
+
diff --git a/src/redturtle/voltoplugin/editablefooter/restapi/deserializer.py b/src/redturtle/voltoplugin/editablefooter/restapi/deserializer.py
index 7e8ee79..48ee160 100644
--- a/src/redturtle/voltoplugin/editablefooter/restapi/deserializer.py
+++ b/src/redturtle/voltoplugin/editablefooter/restapi/deserializer.py
@@ -16,28 +16,20 @@
@implementer(IDeserializeFromJson)
@adapter(IEditableFooterSettings)
-class EditableFooterControlpanelDeserializeFromJson(
- ControlpanelDeserializeFromJson
-):
+class EditableFooterControlpanelDeserializeFromJson(ControlpanelDeserializeFromJson):
def __call__(self):
req = json_body(self.controlpanel.request)
- proxy = self.registry.forInterface(
- self.schema, prefix=self.schema_prefix
- )
+ proxy = self.registry.forInterface(self.schema, prefix=self.schema_prefix)
errors = []
data = req.get("footer_columns", {})
if not data:
- errors.append(
- {"message": "Missing data", "field": "footer_columns"}
- )
+ errors.append({"message": "Missing data", "field": "footer_columns"})
raise BadRequest(errors)
try:
# later we need to do some validations
setattr(proxy, "footer_columns", json.dumps(data))
except ValueError as e:
- errors.append(
- {"message": str(e), "field": "footer_columns", "error": e}
- )
+ errors.append({"message": str(e), "field": "footer_columns", "error": e})
if errors:
raise BadRequest(errors)
diff --git a/src/redturtle/voltoplugin/editablefooter/restapi/get.py b/src/redturtle/voltoplugin/editablefooter/restapi/get.py
index e802f7e..c7f9486 100644
--- a/src/redturtle/voltoplugin/editablefooter/restapi/get.py
+++ b/src/redturtle/voltoplugin/editablefooter/restapi/get.py
@@ -3,10 +3,19 @@
IEditableFooterSettings,
)
from plone import api
+from plone.registry.interfaces import IRegistry
from plone.restapi.services import Service
+from zope.component import getUtility
from zope.interface import implementer
from zope.publisher.interfaces import IPublishTraverse
+try:
+ from plone.volto.interfaces import IVoltoSettings
+
+ HAS_PLONE_VOLTO = True
+except ImportError:
+ HAS_PLONE_VOLTO = False
+
import json
@@ -21,4 +30,33 @@ def reply(self):
)
if not record:
return []
- return json.loads(record)
+ data = json.loads(record)
+ portal_url = self.get_portal_url()
+ for el in data or []:
+ if isinstance(el, dict):
+ for item in el.get("items") or []:
+ if (
+ isinstance(item, dict)
+ and item.get("text") # noqa: W503
+ and isinstance(item.get("text"), dict) # noqa: W503
+ and item.get("text").get("data") # noqa: W503
+ ):
+ item["text"]["data"] = item["text"]["data"].replace(
+ 'href="/', f'href="{portal_url}/'
+ )
+ return data
+
+ def get_portal_url(self):
+ portal_url = api.portal.get().absolute_url()
+ if not HAS_PLONE_VOLTO:
+ return portal_url
+ registry = getUtility(IRegistry)
+ settings = registry.forInterface(IVoltoSettings, prefix="volto", check=False)
+ settings_frontend_domain = getattr(settings, "frontend_domain", None)
+ if not settings_frontend_domain:
+ return portal_url
+ if settings_frontend_domain != "http://localhost:3000":
+ portal_url = settings_frontend_domain
+ if portal_url.endswith("/"):
+ portal_url = portal_url[:-1]
+ return portal_url
diff --git a/src/redturtle/voltoplugin/editablefooter/restapi/serializer.py b/src/redturtle/voltoplugin/editablefooter/restapi/serializer.py
index a845ce0..0428c16 100644
--- a/src/redturtle/voltoplugin/editablefooter/restapi/serializer.py
+++ b/src/redturtle/voltoplugin/editablefooter/restapi/serializer.py
@@ -14,9 +14,7 @@
@adapter(IEditableFooterSettings)
class EditableFooterControlpanelSerializeToJson(ControlpanelSerializeToJson):
def __call__(self):
- json_data = super(
- EditableFooterControlpanelSerializeToJson, self
- ).__call__()
+ json_data = super(EditableFooterControlpanelSerializeToJson, self).__call__()
conf = json_data["data"].get("footer_columns", "")
if conf:
json_data["data"]["footer_columns"] = json.loads(conf)
diff --git a/src/redturtle/voltoplugin/editablefooter/testing.py b/src/redturtle/voltoplugin/editablefooter/testing.py
index e761025..2e74cee 100644
--- a/src/redturtle/voltoplugin/editablefooter/testing.py
+++ b/src/redturtle/voltoplugin/editablefooter/testing.py
@@ -9,10 +9,10 @@
import redturtle.voltoplugin.editablefooter
import plone.restapi
+import plone.volto
class VoltoEditableFooterLayer(PloneSandboxLayer):
-
defaultBases = (PLONE_APP_CONTENTTYPES_FIXTURE,)
def setUpZope(self, app, configurationContext):
@@ -20,6 +20,7 @@ def setUpZope(self, app, configurationContext):
# The z3c.autoinclude feature is disabled in the Plone fixture base
# layer.
self.loadZCML(package=plone.restapi)
+ self.loadZCML(package=plone.volto)
self.loadZCML(package=redturtle.voltoplugin.editablefooter)
def setUpPloneSite(self, portal):
@@ -42,7 +43,6 @@ def setUpPloneSite(self, portal):
class VoltoEditableFooterRestApiLayer(PloneRestApiDXLayer):
-
defaultBases = (PLONE_APP_CONTENTTYPES_FIXTURE,)
def setUpZope(self, app, configurationContext):
@@ -50,7 +50,7 @@ def setUpZope(self, app, configurationContext):
app, configurationContext
)
- self.loadZCML(package=plone.restapi)
+ self.loadZCML(package=plone.volto)
self.loadZCML(package=redturtle.voltoplugin.editablefooter)
def setUpPloneSite(self, portal):
diff --git a/src/redturtle/voltoplugin/editablefooter/tests/test_controlpanel_api.py b/src/redturtle/voltoplugin/editablefooter/tests/test_controlpanel_api.py
index 135d7a4..d3ca613 100644
--- a/src/redturtle/voltoplugin/editablefooter/tests/test_controlpanel_api.py
+++ b/src/redturtle/voltoplugin/editablefooter/tests/test_controlpanel_api.py
@@ -18,7 +18,6 @@
class EditableFooterServiceTest(unittest.TestCase):
-
layer = VOLTO_EDITABLEFOOTER_API_FUNCTIONAL_TESTING
def setUp(self):
@@ -43,18 +42,13 @@ def test_controlpanel_listed(self):
self.assertIn("Editable footer settings", titles)
def test_route_exists(self):
- response = self.api_session.get(
- "/@controlpanels/editable-footer-settings"
- )
+ response = self.api_session.get("/@controlpanels/editable-footer-settings")
self.assertEqual(response.status_code, 200)
- self.assertEqual(
- response.headers.get("Content-Type"), "application/json"
- )
+ self.assertEqual(response.headers.get("Content-Type"), "application/json")
class EditableFooterServiceDeserializerTest(unittest.TestCase):
-
layer = VOLTO_EDITABLEFOOTER_API_FUNCTIONAL_TESTING
def setUp(self):
@@ -79,31 +73,23 @@ def get_record_value(self, field):
return record
def set_record_value(self, field, value):
- api.portal.set_registry_record(
- field, value, interface=IEditableFooterSettings
- )
+ api.portal.set_registry_record(field, value, interface=IEditableFooterSettings)
commit()
def test_set_wrong_data(self):
- response = self.api_session.patch(
- self.controlpanel_url, json={"foo": "bar"}
- )
+ response = self.api_session.patch(self.controlpanel_url, json={"foo": "bar"})
self.assertEqual(response.status_code, 400)
def test_deserializer_convert_dict_into_json_string(self):
-
data = {"foo": "", "bar": 2}
- self.api_session.patch(
- self.controlpanel_url, json={"footer_columns": data}
- )
+ self.api_session.patch(self.controlpanel_url, json={"footer_columns": data})
commit()
self.assertEqual(
self.get_record_value(field="footer_columns"), json.dumps(data)
)
def test_serializer_convert_string_into_json_object(self):
-
self.assertEqual(self.get_record_value(field="footer_columns"), "")
value = {"foo": "bar"}
self.set_record_value(field="footer_columns", value=json.dumps(value))
diff --git a/src/redturtle/voltoplugin/editablefooter/tests/test_footer_columns_route.py b/src/redturtle/voltoplugin/editablefooter/tests/test_footer_columns_route.py
index e296482..d2e236d 100644
--- a/src/redturtle/voltoplugin/editablefooter/tests/test_footer_columns_route.py
+++ b/src/redturtle/voltoplugin/editablefooter/tests/test_footer_columns_route.py
@@ -1,17 +1,19 @@
# -*- 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 redturtle.voltoplugin.editablefooter.interfaces import (
- IEditableFooterSettings,
-)
from transaction import commit
+from zope.component import getUtility
+
import json
import unittest
@@ -32,31 +34,76 @@ def setUp(self):
self.api_session.headers.update({"Accept": "application/json"})
self.api_session.auth = (SITE_OWNER_NAME, SITE_OWNER_PASSWORD)
- self.value = {"foo": "bar"}
- self.set_record_value(
- field="footer_columns", value=json.dumps(self.value)
- )
+ self.value = [
+ {
+ "items": [
+ {"text": {"data": 'Link 1'}},
+ {"text": {"data": 'Link 1'}},
+ ]
+ }
+ ]
+ 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
- )
+ 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(
- response.headers.get("Content-Type"), "application/json"
+ json.dumps(result),
+ json.dumps(self.value).replace('href=\\"/', f'href=\\"{self.portal_url}/'),
)
- def test_return_json_data(self):
+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()
- self.assertEqual(result, self.value)
+ 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}/'
+ ),
+ )
diff --git a/src/redturtle/voltoplugin/editablefooter/tests/test_setup.py b/src/redturtle/voltoplugin/editablefooter/tests/test_setup.py
deleted file mode 100644
index 76689ea..0000000
--- a/src/redturtle/voltoplugin/editablefooter/tests/test_setup.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# -*- coding: utf-8 -*-
-"""Setup tests for this package."""
-from redturtle.voltoplugin.editablefooter.testing import (
- VOLTO_EDITABLEFOOTER_INTEGRATION_TESTING,
-) # noqa: E501
-from plone import api
-from plone.app.testing import setRoles
-from plone.app.testing import TEST_USER_ID
-
-import unittest
-
-
-try:
- from Products.CMFPlone.utils import get_installer
-except ImportError:
- get_installer = None
-
-
-class TestSetup(unittest.TestCase):
- """Test that redturtle.voltoplugin.editablefooter is properly installed."""
-
- layer = VOLTO_EDITABLEFOOTER_INTEGRATION_TESTING
-
- def setUp(self):
- """Custom shared utility setup for tests."""
- self.portal = self.layer["portal"]
- if get_installer:
- self.installer = get_installer(self.portal, self.layer["request"])
- else:
- self.installer = api.portal.get_tool("portal_quickinstaller")
-
- def test_product_installed(self):
- """Test if redturtle.voltoplugin.editablefooter is installed."""
- self.assertTrue(
- self.installer.isProductInstalled(
- "redturtle.voltoplugin.editablefooter"
- )
- )
-
- def test_browserlayer(self):
- """Test that IRedturtleVoltoEditablefooterLayer is registered."""
- from redturtle.voltoplugin.editablefooter.interfaces import (
- IRedturtleVoltoEditablefooterLayer,
- )
- from plone.browserlayer import utils
-
- self.assertIn(
- IRedturtleVoltoEditablefooterLayer, utils.registered_layers()
- )
-
-
-class TestUninstall(unittest.TestCase):
-
- layer = VOLTO_EDITABLEFOOTER_INTEGRATION_TESTING
-
- def setUp(self):
- self.portal = self.layer["portal"]
- if get_installer:
- self.installer = get_installer(self.portal, self.layer["request"])
- else:
- self.installer = api.portal.get_tool("portal_quickinstaller")
- roles_before = api.user.get_roles(TEST_USER_ID)
- setRoles(self.portal, TEST_USER_ID, ["Manager"])
- self.installer.uninstallProducts(
- ["redturtle.voltoplugin.editablefooter"]
- )
- setRoles(self.portal, TEST_USER_ID, roles_before)
-
- def test_product_uninstalled(self):
- """Test if redturtle.voltoplugin.editablefooter is cleanly uninstalled."""
- self.assertFalse(
- self.installer.isProductInstalled(
- "redturtle.voltoplugin.editablefooter"
- )
- )
-
- def test_browserlayer_removed(self):
- """Test that IRedturtleVoltoEditablefooterLayer is removed."""
- from redturtle.voltoplugin.editablefooter.interfaces import (
- IRedturtleVoltoEditablefooterLayer,
- )
- from plone.browserlayer import utils
-
- self.assertNotIn(
- IRedturtleVoltoEditablefooterLayer, utils.registered_layers()
- )
diff --git a/test_plone52.cfg b/test_plone52.cfg
index 1f4da9a..1a74d52 100644
--- a/test_plone52.cfg
+++ b/test_plone52.cfg
@@ -9,6 +9,7 @@ update-versions-file = test_plone52.cfg
[versions]
plone.testing = 7.0.1
+plone.app.caching = 3.1.3
# Added by buildout at 2021-10-11 07:50:20.464790
createcoverage = 1.5
@@ -17,3 +18,20 @@ mccabe = 0.6.1
plone.recipe.codeanalysis = 3.0.1
pycodestyle = 2.7.0
pyflakes = 2.3.1
+
+# Added by buildout at 2024-01-17 10:30:15.067952
+
+# Required by:
+# Plone==5.2.14
+# redturtle.voltoplugin.editablefooter==1.1.3.dev0
+plone.restapi = 9.1.2
+
+# Required by:
+# redturtle.voltoplugin.editablefooter==1.1.3.dev0
+plone.volto = 4.1.0
+
+# Added by buildout at 2024-01-17 10:32:56.251199
+
+# Required by:
+# plone.app.caching==3.1.3
+plone.base = 1.2.0
diff --git a/test_plone60.cfg b/test_plone60.cfg
new file mode 100644
index 0000000..5081fdc
--- /dev/null
+++ b/test_plone60.cfg
@@ -0,0 +1,54 @@
+[buildout]
+
+extends =
+ https://raw.github.com/collective/buildout.plonetest/master/test-6.0.x.cfg
+ https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg
+ base.cfg
+
+update-versions-file = test_plone60.cfg
+
+[versions]
+
+# Added by buildout at 2024-01-17 12:29:47.135659
+build = 1.0.3
+cmarkgfm = 2022.10.27
+coverage = 7.3.2
+createcoverage = 1.5
+flake8 = 6.1.0
+flake8-coding = 1.3.2
+flake8-debugger = 4.1.2
+flake8-print = 5.0.0
+i18ndude = 6.1.0
+keyring = 24.3.0
+markdown-it-py = 3.0.0
+mccabe = 0.7.0
+mdurl = 0.1.2
+nh3 = 0.2.15
+pkginfo = 1.9.6
+plone.recipe.codeanalysis = 3.0.1
+pyflakes = 3.1.0
+pyproject-hooks = 1.0.0
+readme-renderer = 42.0
+requests-toolbelt = 1.0.0
+rfc3986 = 2.0.0
+rich = 13.7.0
+twine = 4.0.2
+zest.releaser = 9.1.1
+zpretty = 3.1.0
+
+# Required by:
+# plone.recipe.codeanalysis==3.0.1
+check-manifest = 0.49
+
+# Required by:
+# keyring==24.3.0
+jaraco.classes = 3.3.0
+
+# Required by:
+# jaraco.classes==3.3.0
+more-itertools = 10.1.0
+
+# Required by:
+# flake8-debugger==4.1.2
+# flake8-print==5.0.0
+pycodestyle = 2.11.0