-
Notifications
You must be signed in to change notification settings - Fork 1
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 #72 from RedTurtle/fix_resolveuid_links
Fix resolveuid links also for Link urls
- Loading branch information
Showing
5 changed files
with
59 additions
and
36 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
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
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,37 @@ | ||
# -*- coding: utf-8 -*- | ||
from plone import api | ||
from plone.app.testing import setRoles | ||
from plone.app.testing import TEST_USER_ID | ||
from plone.restapi.serializer.utils import uid_to_url | ||
from redturtle.volto.testing import REDTURTLE_VOLTO_FUNCTIONAL_TESTING | ||
|
||
import unittest | ||
|
||
|
||
class TestRESOLVEUIDREPatch(unittest.TestCase): | ||
layer = REDTURTLE_VOLTO_FUNCTIONAL_TESTING | ||
|
||
def setUp(self): | ||
self.app = self.layer["app"] | ||
self.portal = self.layer["portal"] | ||
self.portal_url = self.portal.absolute_url() | ||
|
||
setRoles(self.portal, TEST_USER_ID, ["Manager"]) | ||
|
||
self.document = api.content.create( | ||
container=self.portal, | ||
type="Document", | ||
title="Document", | ||
) | ||
|
||
def test_uuid_to_url_with_link_pattern(self): | ||
path = f"/Plone/resolveuid/{self.document.UID()}" | ||
|
||
res = uid_to_url(path) | ||
self.assertEqual(res, self.document.absolute_url()) | ||
|
||
def test_uuid_to_url_with_link_pattern_with_suffix(self): | ||
path = f"/Plone/resolveuid/{self.document.UID()}/@@download/file" | ||
|
||
res = uid_to_url(path) | ||
self.assertEqual(res, f"{self.document.absolute_url()}/@@download/file") |