Skip to content

Commit

Permalink
Merge pull request #20 from plone/python3
Browse files Browse the repository at this point in the history
fix tests in Python 3
  • Loading branch information
David Glick authored Oct 13, 2018
2 parents 51d6d6a + 9af9544 commit 3392077
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ New features:

Bug fixes:

- *add item here*
- Fix tests in Python 3
[davisagli]


3.3.0 (2017-11-24)
Expand Down
9 changes: 5 additions & 4 deletions plone/portlet/collection/tests/functional.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ Go to the home page and see if the portlet looks OK.
>>> portlet = html.xpath('//*[contains(@class, "portletCollection")]')[0]
>>> portlet_contents = etree.tostring(portlet)
>>> def strip_white_space(contents):
... contents = contents.decode('utf-8') if not isinstance(contents, str) else contents
... lines = [line.strip() for line in contents.splitlines() if line.strip()]
... return '\n'.join(lines)
>>> print strip_white_space(portlet_contents)
>>> print(strip_white_space(portlet_contents))
<section class="portlet portletCollection portlet-collection-test-collection"><header class="portletHeader">
<span class="portletTopLeft"...
<a href="http://nohost/plone/test-collection">
Expand Down Expand Up @@ -113,7 +114,7 @@ Now test what happens if we toggle the "show more link" option.
True
>>> browser.getControl(label="Show more... link").selected = False
>>> browser.getControl('Save').click()
>>> print browser.url
>>> print(browser.url)
http://nohost/plone/@@manage-portlets

Go back to the home page and see if it looks OK.
Expand All @@ -122,7 +123,7 @@ Go back to the home page and see if it looks OK.
>>> html = etree.HTML(browser.contents)
>>> portlet = html.xpath('//*[contains(@class, "portletCollection")]')[0]
>>> portlet_contents = etree.tostring(portlet)
>>> '<a href="http://nohost/plone/test-collection">' in portlet_contents
>>> b'<a href="http://nohost/plone/test-collection">' in portlet_contents
False

Now test what happens if we toggle the "show dates" option.
Expand All @@ -133,7 +134,7 @@ Now test what happens if we toggle the "show dates" option.
True
>>> browser.getControl("Show dates").selected = True
>>> browser.getControl("Save").click()
>>> print browser.url
>>> print(browser.url)
http://nohost/plone/@@manage-portlets

Make sure the dates show up::
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
keywords='collection portlet',
author='Plone Foundation',
Expand Down

0 comments on commit 3392077

Please sign in to comment.