Skip to content

Commit

Permalink
add some tests for themefileupload as these fail with current plone.rest
Browse files Browse the repository at this point in the history
  • Loading branch information
djay committed Feb 18, 2018
1 parent ef63296 commit 58eb1ff
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/plone/app/theming/tests/test_controlpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,38 @@ def test_create_theme(self):

# self.assertTrue('foobar' in [t.__name__ for t in getZODBThemes()])
# self.assertTrue(getTheme('foobar') is not None)


def test_upload_theme_file_nodata(self):
self.browser.addHeader('Accept', 'application/json')
self.browser.post(
self.portal.absolute_url() + '/portal_resources/themeFileUpload',
'',
)
self.assertIn('Status: 200 Ok', str(self.browser.headers))
self.assertIn(
'{"failure": "error"}',
str(self.browser.contents)
)

def test_upload_theme_file_withdata(self):
self.browser.addHeader('Accept', 'application/json')
self.browser.post(
self.portal.absolute_url() + '/portal_resources/themeFileUpload',
"""
---blah---
Content-Disposition: form-data; name="file"; filename="Screen Shot 2018-02-16 at 3.08.15 pm.png"
Content-Type: image/png
---blah---
""",
# Bug in testbrowser prevents this working
# content_type='multipart/form-data; boundary=---blah---'

)
self.assertIn('Status: 200 Ok', str(self.browser.headers))
self.assertIn(
'{"failure": "error"}', # TODO: Should be {'success':'create'}
str(self.browser.contents)
)

1 comment on commit 58eb1ff

@mister-roboto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dylan Jay your emails are not known to GitHub and thus it is impossible to know if you have signed the Plone Contributor Agreement, which is required to merge this pull request.

Learn about the Plone Contributor Agreement: http://docs.plone.org/develop/coredev/docs/contributors_agreement_explained.html How to add more emails to your GitHub account: https://help.github.com/articles/adding-an-email-address-to-your-github-account/

Please sign in to comment.