-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from plone/122-portrait-image-file-not-suppor…
…ted-by-pil 122 portrait image file not supported by pil
- Loading branch information
Showing
7 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Fix #122 validating if image is supported by PIL showing a validation error if not. | ||
Include Pillow dependency in setup.py. | ||
Fix ValueError: User could not be found in BaseTest setUp adding a transaction.commit(). | ||
[rber474] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from pkg_resources import resource_stream | ||
from plone.app.testing import SITE_OWNER_NAME | ||
from plone.app.testing import SITE_OWNER_PASSWORD | ||
from plone.app.users.tests.base import BaseTestCase | ||
|
||
|
||
class TestPortrait(BaseTestCase): | ||
def test_regression_supported_image_type_122(self): | ||
# https://github.com/plone/plone.app.users/issues/122 | ||
|
||
self.browser.open("http://nohost/plone/") | ||
self.browser.getLink("Log in").click() | ||
self.browser.getControl("Login Name").value = SITE_OWNER_NAME | ||
self.browser.getControl("Password").value = SITE_OWNER_PASSWORD | ||
self.browser.getControl("Log in").click() | ||
self.browser.open("http://nohost/plone/@@personal-information") | ||
self.browser.getControl(name="form.widgets.email").value = "[email protected]" | ||
portrait_file = resource_stream("plone.app.users.tests", "onepixel.jpg") | ||
self.browser.getControl(name="form.widgets.portrait").add_file( | ||
portrait_file, "image/jpg", "onepixel.# jpg" | ||
) | ||
self.browser.getControl("Save").click() | ||
self.assertIn("Changes saved.", self.browser.contents) | ||
|
||
def test_not_supported_image_type_122(self): | ||
# https://github.com/plone/plone.app.users/issues/122 | ||
|
||
self.browser.open("http://nohost/plone/") | ||
self.browser.getLink("Log in").click() | ||
self.browser.getControl("Login Name").value = SITE_OWNER_NAME | ||
self.browser.getControl("Password").value = SITE_OWNER_PASSWORD | ||
self.browser.getControl("Log in").click() | ||
self.browser.open("http://nohost/plone/@@personal-information") | ||
self.browser.getControl(name="form.widgets.email").value = "[email protected]" | ||
portrait_file = resource_stream( | ||
"plone.app.users.tests", "transparent_square.svg" | ||
) | ||
self.browser.getControl(name="form.widgets.portrait").add_file( | ||
portrait_file, "image/svg+xml", "onepixel.# jpg" | ||
) | ||
self.browser.getControl("Save").click() | ||
self.assertIn( | ||
"The file you selected is not supported by Pillow. Please choose another.", | ||
self.browser.contents, | ||
) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters