Skip to content

Commit

Permalink
Make doctests work with new zope.testbrowser based on Webtest
Browse files Browse the repository at this point in the history
  • Loading branch information
pbauer committed Feb 3, 2017
1 parent dd810a0 commit 37a6625
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 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*
- Make doctests work with new zope.testbrowser based on Webtest.
[pbauer]


1.6.5 (2016-11-09)
Expand Down
14 changes: 6 additions & 8 deletions src/plone/app/blob/tests/replacement-types.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Let's start with creating a "File" content item:
'http://nohost/plone/.../portal_factory/File/file.../edit...'
>>> browser.getControl(name='title').value = 'Foo'
>>> control = browser.getControl(name='file_file')
>>> control.filename = 'foo.pdf'
>>> control.value = StringIO('%PDF-1.4 fake pdf...' + 'foo' * 1000)
>>> testfile = StringIO('%PDF-1.4 fake pdf...' + 'foo' * 1000)
>>> control.add_file(testfile, None, 'foo.pdf')
>>> browser.getControl('Save').click()

>>> browser.url
Expand All @@ -42,8 +42,8 @@ Now let's make sure we can also edit it:
>>> browser.getControl(name='title').value = 'Foobar'
>>> browser.getControl('Replace with new file').selected = True
>>> control = browser.getControl(name='file_file')
>>> control.filename = 'foobar.pdf'
>>> control.value = StringIO('%PDF-1.4 fake pdf...' + 'foobar' * 1000)
>>> testfile = StringIO('%PDF-1.4 fake pdf...' + 'foo' * 1000)
>>> control.add_file(testfile, None, 'foobar.pdf')
>>> browser.getControl('Save').click()

>>> browser.url
Expand Down Expand Up @@ -84,8 +84,7 @@ Next a similar test is conducted for an "Image" content item:
'http://nohost/plone/.../portal_factory/Image/image.../edit...'
>>> browser.getControl(name='title').value = 'Bar'
>>> control = browser.getControl(name='image_file')
>>> control.filename = 'bar.gif'
>>> control.value = getFile('image.png')
>>> control.add_file(getFile('image.png'), None, 'bar.gif')
>>> browser.getControl('Save').click()

>>> browser.url
Expand All @@ -107,8 +106,7 @@ however, so we can check it was actually updated:
>>> browser.getControl(name='title').value = 'Foobar'
>>> browser.getControl('Replace with new image').selected = True
>>> control = browser.getControl(name='image_file')
>>> control.filename = 'foobar.gif'
>>> control.value = getFile('image.gif')
>>> control.add_file(getFile('image.gif'), None, 'foobar.gif')
>>> browser.getControl('Save').click()

>>> browser.url
Expand Down

0 comments on commit 37a6625

Please sign in to comment.