diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index f870129..624adae 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.8] + python-version: [3.11] steps: # git checkout @@ -19,7 +19,7 @@ jobs: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 97c7dfa..fad8f11 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.8] + python-version: [3.11] steps: # git checkout @@ -19,7 +19,7 @@ jobs: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/.github/workflows/pyroma.yml b/.github/workflows/pyroma.yml index bbad3c2..271b834 100644 --- a/.github/workflows/pyroma.yml +++ b/.github/workflows/pyroma.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.8] + python-version: [3.11] steps: # git checkout @@ -19,7 +19,7 @@ jobs: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} @@ -28,7 +28,7 @@ jobs: # install pyroma - name: install pyroma - run: pip install pyroma + run: pip install pyroma==4.2 # run pyroma - name: run pyroma diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index adfbdce..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Tests - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - max-parallel: 4 - matrix: - python: ["3.7"] - plone: ["52"] - # exclude: - # - python: "3.7" - # plone: "51" - steps: - - uses: actions/checkout@v1 - - name: Cache eggs - uses: actions/cache@v1 - with: - path: eggs - key: ${{ runner.OS }}-build-python${{ matrix.python }}-${{ matrix.plone }} - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python }} - - name: Install dependencies - run: | - pip install -r requirements.txt -c constraints_plone${{ matrix.plone }}.txt - cp test_plone${{ matrix.plone }}.cfg buildout.cfg - - name: Install buildout - run: | - buildout -N -t 3 - - name: Run tests - run: | - bin/test diff --git a/.github/workflows/zpretty.yml b/.github/workflows/zpretty.yml index 180f0e9..99de6a8 100644 --- a/.github/workflows/zpretty.yml +++ b/.github/workflows/zpretty.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.8] + python-version: [3.11] steps: # git checkout @@ -19,7 +19,7 @@ jobs: python-version: ${{ matrix.python-version }} # python cache - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/CHANGES.rst b/CHANGES.rst index 40e9409..28e6e8f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 2.1.1 (unreleased) ------------------ -- Nothing changed yet. +- Plone 6 compatibility. Use 2.x tags for Plone < 6. [cekk] + [cekk] 2.1.0 (2023-05-31) @@ -50,10 +51,10 @@ Changelog - Add flag to control panel that allow to enable cookie banner - Add cookie prefix to control panel to control the js plugin option - Allow to select endpoint for consent registry -- Add domain whitelist so in case you have site with multiple domain can show +- Add domain whitelist so in case you have site with multiple domain can show the banner in selected domain - Add matomo -- Some minor fix to prevent cases where site editor remove configuration lines +- Some minor fix to prevent cases where site editor remove configuration lines partially - Add log tracking to new introduced actions - Fix problem loading twitter timeline in tile manager from diff --git a/constraints_plone60.txt b/constraints_plone60.txt new file mode 100644 index 0000000..005e694 --- /dev/null +++ b/constraints_plone60.txt @@ -0,0 +1 @@ +-c https://dist.plone.org/release/6.0-latest/requirements.txt diff --git a/constraints_plone61.txt b/constraints_plone61.txt new file mode 100644 index 0000000..4b1a25e --- /dev/null +++ b/constraints_plone61.txt @@ -0,0 +1 @@ +-c https://dist.plone.org/release/6.1-latest/requirements.txt diff --git a/requirements.txt b/requirements.txt index 06390bd..bcb25bb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ --c constraints.txt setuptools zc.buildout diff --git a/src/redturtle/chefcookie/tests/robot/test_example.robot b/src/redturtle/chefcookie/tests/robot/test_example.robot deleted file mode 100644 index a9dd194..0000000 --- a/src/redturtle/chefcookie/tests/robot/test_example.robot +++ /dev/null @@ -1,66 +0,0 @@ -# ============================================================================ -# EXAMPLE ROBOT TESTS -# ============================================================================ -# -# Run this robot test stand-alone: -# -# $ bin/test -s redturtle.chefcookie -t test_example.robot --all -# -# Run this robot test with robot server (which is faster): -# -# 1) Start robot server: -# -# $ bin/robot-server --reload-path src redturtle.chefcookie.testing.REDTURTLE_CHEFCOOKIE_ACCEPTANCE_TESTING -# -# 2) Run robot tests: -# -# $ bin/robot src/redturtle/chefcookie/tests/robot/test_example.robot -# -# See the http://docs.plone.org for further details (search for robot -# framework). -# -# ============================================================================ - -*** Settings ***************************************************************** - -Resource plone/app/robotframework/selenium.robot -Resource plone/app/robotframework/keywords.robot - -Library Remote ${PLONE_URL}/RobotRemote - -Test Setup Open test browser -Test Teardown Close all browsers - - -*** Test Cases *************************************************************** - -Scenario: As a member I want to be able to log into the website - [Documentation] Example of a BDD-style (Behavior-driven development) test. - Given a login form - When I enter valid credentials - Then I am logged in - - -*** Keywords ***************************************************************** - -# --- Given ------------------------------------------------------------------ - -a login form - Go To ${PLONE_URL}/login_form - Wait until page contains Login Name - Wait until page contains Password - - -# --- WHEN ------------------------------------------------------------------- - -I enter valid credentials - Input Text __ac_name admin - Input Text __ac_password secret - Click Button Log in - - -# --- THEN ------------------------------------------------------------------- - -I am logged in - Wait until page contains You are now logged in - Page should contain You are now logged in diff --git a/src/redturtle/chefcookie/tests/test_robot.py b/src/redturtle/chefcookie/tests/test_robot.py deleted file mode 100644 index f807757..0000000 --- a/src/redturtle/chefcookie/tests/test_robot.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -from redturtle.chefcookie.testing import ( - REDTURTLE_CHEFCOOKIE_ACCEPTANCE_TESTING, -) # noqa: E501 -from plone.app.testing import ROBOT_TEST_LEVEL -from plone.testing import layered - -import os -import robotsuite -import unittest - - -def test_suite(): - suite = unittest.TestSuite() - current_dir = os.path.abspath(os.path.dirname(__file__)) - robot_dir = os.path.join(current_dir, "robot") - robot_tests = [ - os.path.join("robot", doc) - for doc in os.listdir(robot_dir) - if doc.endswith(".robot") and doc.startswith("test_") - ] - for robot_test in robot_tests: - robottestsuite = robotsuite.RobotTestSuite(robot_test) - robottestsuite.level = ROBOT_TEST_LEVEL - suite.addTests( - [ - layered( - robottestsuite, - layer=REDTURTLE_CHEFCOOKIE_ACCEPTANCE_TESTING, - ), - ] - ) - return suite diff --git a/src/redturtle/chefcookie/tests/test_setup.py b/src/redturtle/chefcookie/tests/test_setup.py deleted file mode 100644 index bd7a9ee..0000000 --- a/src/redturtle/chefcookie/tests/test_setup.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- -"""Setup tests for this package.""" -from redturtle.chefcookie.testing import ( - REDTURTLE_CHEFCOOKIE_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.chefcookie is properly installed.""" - - layer = REDTURTLE_CHEFCOOKIE_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.chefcookie is installed.""" - self.assertTrue(self.installer.isProductInstalled("redturtle.chefcookie")) - - def test_browserlayer(self): - """Test that IRedturtleChefcookieLayer is registered.""" - from redturtle.chefcookie.interfaces import IRedturtleChefcookieLayer - from plone.browserlayer import utils - - self.assertIn(IRedturtleChefcookieLayer, utils.registered_layers()) - - -class TestUninstall(unittest.TestCase): - - layer = REDTURTLE_CHEFCOOKIE_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.chefcookie"]) - setRoles(self.portal, TEST_USER_ID, roles_before) - - def test_product_uninstalled(self): - """Test if redturtle.chefcookie is cleanly uninstalled.""" - self.assertFalse(self.installer.isProductInstalled("redturtle.chefcookie")) - - def test_browserlayer_removed(self): - """Test that IRedturtleChefcookieLayer is removed.""" - from redturtle.chefcookie.interfaces import IRedturtleChefcookieLayer - from plone.browserlayer import utils - - self.assertNotIn(IRedturtleChefcookieLayer, utils.registered_layers()) diff --git a/src/redturtle/chefcookie/transformers/transform.py b/src/redturtle/chefcookie/transformers/transform.py index 9749345..36753b2 100644 --- a/src/redturtle/chefcookie/transformers/transform.py +++ b/src/redturtle/chefcookie/transformers/transform.py @@ -12,7 +12,7 @@ from zope.component import getMultiAdapter from zope.component import getUtility from zope.component import queryMultiAdapter -from zope.component.interfaces import ComponentLookupError +from zope.interface.interfaces import ComponentLookupError from zope.interface import implementer from zope.interface import Interface diff --git a/test_plone52.cfg b/test_plone52.cfg index 54cfda0..f8a7c22 100644 --- a/test_plone52.cfg +++ b/test_plone52.cfg @@ -9,25 +9,3 @@ update-versions-file = test_plone52.cfg [versions] plone.testing = 7.0.1 - -# Added by buildout at 2021-12-30 15:58:32.220210 -collective.recipe.vscode = 0.1.7 -flake8 = 3.9.2 -mccabe = 0.6.1 -plone.recipe.codeanalysis = 3.0.1 -pycodestyle = 2.7.0 -pyflakes = 2.3.1 - -# Required by: -# redturtle.chefcookie==1.0 -collective.jsconfiguration = 0.1.1 - -# Required by: -# redturtle.chefcookie==1.0 -collective.regjsonify = 0.3.0 - -# Added by buildout at 2022-01-05 09:23:45.884226 -zpretty = 2.1.0 - -# Added by buildout at 2022-02-02 17:29:45.340786 -zipp = 1.1.1 diff --git a/test_plone60.cfg b/test_plone60.cfg new file mode 100644 index 0000000..3c739e0 --- /dev/null +++ b/test_plone60.cfg @@ -0,0 +1,8 @@ +[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 + +[versions] diff --git a/test_plone61.cfg b/test_plone61.cfg new file mode 100644 index 0000000..3da9fdc --- /dev/null +++ b/test_plone61.cfg @@ -0,0 +1,6 @@ +[buildout] +extends = + https://raw.github.com/collective/buildout.plonetest/master/test-6.1.x.cfg + https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg + base.cfg +[versions]