Skip to content

Commit

Permalink
Merge pull request #335 from collective/py2-tests
Browse files Browse the repository at this point in the history
Fix python 2 tests
  • Loading branch information
pbauer committed Apr 1, 2022
2 parents 2745518 + 2e029c6 commit cf2b049
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
matrix:
config:
# [Python version, tox env]
- ["2.7", "plone52-py27"]
- ["3.7", "plone52-py37"]
- ["3.8", "plone52-py38"]
- ["3.9", "plone52-py39"]
Expand Down
6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
setuptools==59.8.0
zc.buildout==3.0.0rc2
setuptools==44.1.1
zc.buildout==3.0.0rc1
wheel==0.37.1
pip==20.3.4
2 changes: 1 addition & 1 deletion src/collective/easyform/tests/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ who doesn't have permission to edit the form, SSL will be forced on initial form
well (so the user sees a security icon in their browser.) ::

>>> auth = browser.getControl(name='_authenticator', index=0).value
>>> browser.open(portal_url + f'/testform/content_status_modify?workflow_action=publish&_authenticator={auth}')
>>> browser.open(portal_url + '/testform/content_status_modify?workflow_action=publish&_authenticator={}'.format(auth))
>>> 'Item state changed' in browser.contents
True

Expand Down
12 changes: 6 additions & 6 deletions src/collective/easyform/tests/testApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,20 @@ def test_selective_widgets(self):
"""

self.assertEqual(
list(filter_widgets(self.ff1, self.dummy_form.w).keys()),
["replyto", "topic", "comments"],
set(filter_widgets(self.ff1, self.dummy_form.w).keys()),
set(["replyto", "topic", "comments"]),
)

self.ff1.showFields = ("topic", "comments")
self.assertEqual(
list(filter_widgets(self.ff1, self.dummy_form.w).keys()),
["replyto", "topic", "comments"],
set(filter_widgets(self.ff1, self.dummy_form.w).keys()),
set(["replyto", "topic", "comments"]),
)

self.ff1.showAll = False
self.assertEqual(
list(filter_widgets(self.ff1, self.dummy_form.w).keys()),
["topic", "comments"],
set(filter_widgets(self.ff1, self.dummy_form.w).keys()),
set(["topic", "comments"]),
)

def test_selective_fields(self):
Expand Down
2 changes: 1 addition & 1 deletion src/collective/easyform/tests/testEvents.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ def testActiveAdaptersNotDuplicatedOnFormCopy(self):
active_adapters = tuple(get_actions(ff2))
self.assertEqual(active_adapters, ("mailer",))
active_fields = tuple(get_schema(ff2))
self.assertEqual(active_fields, ("replyto", "topic", "comments"))
self.assertEqual(set(active_fields), set(["replyto", "topic", "comments"]))
7 changes: 4 additions & 3 deletions src/collective/easyform/tests/testSaver.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,10 @@ def testSetSavedFormInput(self):
items[1][1],
dict(list(zip(["id"] + fields, [items[1][0], "four", "five", "six"]))),
)
self.assertEqual(
saver.getSavedFormInputForEdit(), "one,two,three\r\nfour,five,six\r\n"
)

# order can change in py2
for number in ["one", "two", "three", "four", "five", "six"]:
self.assertIn(number, saver.getSavedFormInputForEdit())

# save empty string
saver.clearSavedFormInput()
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
minversion = 3.18
envlist =
plone52-py{37,38,39}
plone52-py{27,37,38,39}
plone60-py{37,38,39}

[testenv]
Expand Down

0 comments on commit cf2b049

Please sign in to comment.