Skip to content

Commit

Permalink
Merge branch 'custom-label-mapping' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffersonBledsoe committed Sep 25, 2023
2 parents 28eefd6 + bd40e5c commit 6761be9
Show file tree
Hide file tree
Showing 18 changed files with 130 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ relative_files = True

[report]
include =
src/collective/*
*/src/collective/*
omit =
*/test*
/home/*/.buildout/eggs/*
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ jobs:
strategy:
max-parallel: 4
matrix:
python: ["3.9"]
plone: ["52"]
# exclude:
# - python: "3.7"
# plone: "51"
python: ["3.8", "3.9", "3.10", "3.11"]
plone: ["52", "60"]
exclude:
- python: "3.9"
plone: "52"
- python: "3.10"
plone: "52"
- python: "3.11"
plone: "52"
steps:
- uses: actions/checkout@v3
- name: Cache eggs
Expand All @@ -36,8 +40,7 @@ jobs:
bin/code-analysis
- name: Run tests
run: |
bin/test
# bin/test-coverage
bin/test-coverage
- name: createcoverage
run: |
bin/createcoverage -t '--all'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ lib64
log.html
output.xml
pip-selfcheck.json
.coverage
report.html
.vscode/
.tox/
Expand Down
1 change: 1 addition & 0 deletions base.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ recipe = collective.recipe.template
input = inline:
#!/bin/bash
export TZ=UTC
set -e
${buildout:directory}/bin/coverage run bin/test $*
${buildout:directory}/bin/coverage html
${buildout:directory}/bin/coverage report -m --fail-under=90
Expand Down
1 change: 1 addition & 0 deletions constraints_plone60.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-c https://dist.plone.org/release/6.0-latest/requirements.txt
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-c constraints.txt
setuptools
zc.buildout
wheel
1 change: 1 addition & 0 deletions src/collective/volto/formsupport/captcha/hcaptcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from collective.volto.formsupport import _
from plone.formwidget.hcaptcha.interfaces import IHCaptchaSettings
from plone.formwidget.hcaptcha.nohcaptcha import submit

# from plone.formwidget.hcaptcha.validator import WrongCaptchaCode
from plone.registry.interfaces import IRegistry
from zExceptions import BadRequest
Expand Down
8 changes: 2 additions & 6 deletions src/collective/volto/formsupport/captcha/norobots.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ class NoRobotsSupport(CaptchaSupport):
def __init__(self, context, request):
super().__init__(context, request)
registry = queryUtility(IRegistry)
self.settings = registry.forInterface(
INorobotsWidgetSettings, check=False
)
self.settings = registry.forInterface(INorobotsWidgetSettings, check=False)

def isEnabled(self):
return self.settings and self.settings.questions
Expand Down Expand Up @@ -66,9 +64,7 @@ def verify(self, data):
if not view.verify(input=value, question_id=id, id_check=id_check):
raise BadRequest(
translate(
_(
"The code you entered was wrong, please enter the new one."
),
_("The code you entered was wrong, please enter the new one."),
context=self.request,
)
)
2 changes: 0 additions & 2 deletions src/collective/volto/formsupport/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class VoltoFormsupportLayer(PloneSandboxLayer):

defaultBases = (PLONE_APP_CONTENTTYPES_FIXTURE,)

def setUpZope(self, app, configurationContext):
Expand Down Expand Up @@ -48,7 +47,6 @@ def setUpPloneSite(self, portal):


class VoltoFormsupportRestApiLayer(PloneRestApiDXLayer):

defaultBases = (PLONE_APP_CONTENTTYPES_FIXTURE,)

def setUpZope(self, app, configurationContext):
Expand Down
1 change: 0 additions & 1 deletion src/collective/volto/formsupport/tests/test_captcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@


class TestCaptcha(unittest.TestCase):

layer = VOLTO_FORMSUPPORT_API_FUNCTIONAL_TESTING

def setUp(self):
Expand Down
2 changes: 0 additions & 2 deletions src/collective/volto/formsupport/tests/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def event_handler(event):


class TestEvent(unittest.TestCase):

layer = VOLTO_FORMSUPPORT_API_FUNCTIONAL_TESTING

def setUp(self):
Expand Down Expand Up @@ -91,7 +90,6 @@ def submit_form(self, data):
def test_trigger_event(
self,
):

self.document.blocks = {
"text-id": {"@type": "text"},
"form-id": {
Expand Down
4 changes: 0 additions & 4 deletions src/collective/volto/formsupport/tests/test_honeypot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@


class TestHoneypot(unittest.TestCase):

layer = VOLTO_FORMSUPPORT_API_FUNCTIONAL_TESTING

def setUp(self):
Expand Down Expand Up @@ -72,7 +71,6 @@ def submit_form(self, data):
return response

def test_honeypot_installed_but_field_not_in_form(self):

self.document.blocks = {
"text-id": {"@type": "text"},
"form-id": {
Expand Down Expand Up @@ -107,7 +105,6 @@ def test_honeypot_installed_but_field_not_in_form(self):
)

def test_honeypot_field_in_form_empty_pass_validation(self):

self.document.blocks = {
"text-id": {"@type": "text"},
"form-id": {
Expand Down Expand Up @@ -138,7 +135,6 @@ def test_honeypot_field_in_form_empty_pass_validation(self):
self.assertEqual(response.status_code, 204)

def test_honeypot_field_in_form_compiled_fail_validation(self):

self.document.blocks = {
"text-id": {"@type": "text"},
"form-id": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


class TestBlockSerialization(unittest.TestCase):

layer = VOLTO_FORMSUPPORT_API_FUNCTIONAL_TESTING

def setUp(self):
Expand Down Expand Up @@ -74,7 +73,6 @@ def test_serializer_return_filtered_block_data_to_anon(self):


class TestBlockSerializationRecaptcha(unittest.TestCase):

layer = VOLTO_FORMSUPPORT_API_FUNCTIONAL_TESTING

def setUp(self):
Expand Down Expand Up @@ -131,7 +129,6 @@ def test_serializer_with_recaptcha(self):


class TestBlockSerializationHCaptcha(unittest.TestCase):

layer = VOLTO_FORMSUPPORT_API_FUNCTIONAL_TESTING

def setUp(self):
Expand Down Expand Up @@ -188,7 +185,6 @@ def test_serializer_with_hcaptcha(self):


class TestBlockSerializationAttachmentsLimit(unittest.TestCase):

layer = VOLTO_FORMSUPPORT_API_FUNCTIONAL_TESTING

def setUp(self):
Expand Down
28 changes: 20 additions & 8 deletions src/collective/volto/formsupport/tests/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ def setUp(self):

def test_product_installed(self):
"""Test if collective.volto.formsupport is installed."""
self.assertTrue(
self.installer.isProductInstalled("collective.volto.formsupport")
)
if hasattr(self.installer, "isProductInstalled"):
self.assertTrue(
self.installer.isProductInstalled("collective.volto.formsupport")
)
else: # plone 6
self.assertTrue(
self.installer.is_product_installed("collective.volto.formsupport")
)

def test_browserlayer(self):
"""Test that ICollectiveVoltoFormsupportLayer is registered."""
Expand All @@ -46,7 +51,6 @@ def test_browserlayer(self):


class TestUninstall(unittest.TestCase):

layer = VOLTO_FORMSUPPORT_INTEGRATION_TESTING

def setUp(self):
Expand All @@ -57,14 +61,22 @@ def setUp(self):
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(["collective.volto.formsupport"])
if hasattr(self.installer, "uninstallProducts"):
self.installer.uninstallProducts(["collective.volto.formsupport"])
else: # plone6
self.installer.uninstall_product("collective.volto.formsupport")
setRoles(self.portal, TEST_USER_ID, roles_before)

def test_product_uninstalled(self):
"""Test if collective.volto.formsupport is cleanly uninstalled."""
self.assertFalse(
self.installer.isProductInstalled("collective.volto.formsupport")
)
if hasattr(self.installer, "isProductInstalled"):
self.assertFalse(
self.installer.isProductInstalled("collective.volto.formsupport")
)
else: # plone 6
self.assertFalse(
self.installer.is_product_installed("collective.volto.formsupport")
)

def test_browserlayer_removed(self):
"""Test that ICollectiveVoltoFormsupportLayer is removed."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


class TestMailSend(unittest.TestCase):

layer = VOLTO_FORMSUPPORT_API_FUNCTIONAL_TESTING

def setUp(self):
Expand Down
8 changes: 3 additions & 5 deletions src/collective/volto/formsupport/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def flatten_block_hierachy(blocks):
""" Given some blocks, return all contained blocks, including "subblocks"
"""Given some blocks, return all contained blocks, including "subblocks"
This allows embedding the form block into something like columns datastorage
"""

Expand All @@ -21,16 +21,14 @@ def flatten_block_hierachy(blocks):
if "data" in block_value:
if isinstance(block_value["data"], dict):
if "blocks" in block_value["data"]:
queue.extend(list(
block_value["data"]["blocks"].items()))
queue.extend(list(block_value["data"]["blocks"].items()))

if "blocks" in block_value:
queue.extend(list(block_value["blocks"].items()))


def get_blocks(context):
""" Returns all blocks from a context, including those coming from slots
"""
"""Returns all blocks from a context, including those coming from slots"""

blocks = copy.deepcopy(getattr(context, "blocks", {}))
if isinstance(blocks, six.text_type):
Expand Down
3 changes: 3 additions & 0 deletions test_plone52.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ plone.formwidget.recaptcha = 2.3.0

# Added by buildout at 2022-06-08 10:07:55.395703
collective.z3cform.norobots = 2.0

# Added by buildout at 2023-09-18 12:59:01.353135
collective.honeypot = 2.1
86 changes: 86 additions & 0 deletions test_plone60.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[buildout]

extends =
https://raw.githubusercontent.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 2023-09-18 11:12:41.176409
bleach = 6.0.0
build = 0.10.0
collective.honeypot = 2.1
collective.z3cform.norobots = 2.0
coverage = 7.2.2
createcoverage = 1.5
flake8 = 6.1.0
i18ndude = 5.5.0
keyring = 23.13.1
markdown-it-py = 2.2.0
mccabe = 0.7.0
mdurl = 0.1.2
odict = 1.9.0
pkginfo = 1.9.6
plone.formwidget.hcaptcha = 1.0.0
plone.formwidget.recaptcha = 2.3.0
plone.recipe.codeanalysis = 3.0.1
plumber = 1.7
pycodestyle = 2.11.0
pyflakes = 3.1.0
pyproject-hooks = 1.0.0
readme-renderer = 37.3
repoze.catalog = 0.9.0
requests-toolbelt = 0.10.1
rfc3986 = 2.0.0
rich = 13.3.4
twine = 4.0.2
zest.releaser = 7.3.0
zope.index = 5.2.1

# Required by:
# plone.recipe.codeanalysis==3.0.1
check-manifest = 0.49

# Required by:
# zest.releaser==7.3.0
colorama = 0.4.6

# Required by:
# keyring==23.13.1
jaraco.classes = 3.2.3

# Required by:
# jaraco.classes==3.2.3
more-itertools = 9.1.0

# Required by:
# node.ext.zodb==1.4
node = 1.2

# Required by:
# souper==1.1.1
node.ext.zodb = 1.4

# Required by:
# souper.plone==1.3.1
souper = 1.1.1

# Required by:
# collective.volto.formsupport==2.6.3.dev0
souper.plone = 1.3.1

# Required by:
# check-manifest==0.49
tomli = 2.0.1

# Required by:
# bleach==6.0.0
webencodings = 0.5.1

# Required by:
# collective.honeypot==2.1
# collective.volto.formsupport==2.6.3.dev0
z3c.jbot = 1.1.1

0 comments on commit 6761be9

Please sign in to comment.