-
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.
- Loading branch information
Showing
3 changed files
with
74 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
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,39 @@ | ||
from plone import api | ||
from plone.app.testing import setRoles | ||
from plone.app.testing import SITE_OWNER_NAME | ||
from plone.app.testing import SITE_OWNER_PASSWORD | ||
from plone.app.testing import TEST_USER_ID | ||
from plone.restapi.testing import RelativeSession | ||
from redturtle.volto.testing import REDTURTLE_VOLTO_API_FUNCTIONAL_TESTING | ||
from transaction import commit | ||
|
||
import unittest | ||
|
||
|
||
class TestNoAcquisition(unittest.TestCase): | ||
layer = REDTURTLE_VOLTO_API_FUNCTIONAL_TESTING | ||
|
||
def setUp(self): | ||
self.app = self.layer["app"] | ||
self.portal = self.layer["portal"] | ||
self.request = self.layer["request"] | ||
self.portal_url = self.portal.absolute_url() | ||
setRoles(self.portal, TEST_USER_ID, ["Manager"]) | ||
|
||
self.api_session = RelativeSession(self.portal_url) | ||
self.api_session.headers.update({"Accept": "application/json"}) | ||
self.api_session.auth = (SITE_OWNER_NAME, SITE_OWNER_PASSWORD) | ||
|
||
self.document = api.content.create( | ||
container=self.portal, type="Document", title="aaa" | ||
) | ||
|
||
self.child = api.content.create( | ||
container=self.document, type="Document", title="bbb" | ||
) | ||
|
||
commit() | ||
|
||
def test_with_noacquisition_enabled_get_not_found(self): | ||
response = self.api_session.get(f"{self.document.absolute_url()}/aaa/aaa/bbb") | ||
self.assertEqual(response.status_code, 404) |
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,32 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Setup tests for this package.""" | ||
from plone import api | ||
from plone.app.testing import setRoles | ||
from plone.app.testing import TEST_USER_ID | ||
from Products.CMFPlone.controlpanel.browser.redirects import absolutize_path | ||
from redturtle.volto.testing import REDTURTLE_VOLTO_INTEGRATION_TESTING | ||
|
||
import unittest | ||
|
||
|
||
class TestAbsolutizePath(unittest.TestCase): | ||
""" """ | ||
|
||
layer = REDTURTLE_VOLTO_INTEGRATION_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.foo = api.content.create( | ||
container=self.portal, | ||
type="Document", | ||
title="Foo", | ||
) | ||
|
||
def test_patched_method_allows_to_create_alias_with_same_path(self): | ||
# by default will return | ||
# ('/plone/foo/foo', 'Cannot use a working path as alternative url.') | ||
self.assertEqual(absolutize_path("/foo/foo"), ("/plone/foo/foo", None)) |