1+ from kitconcept .solr .testing import FUNCTIONAL_TESTING
12from plone .app .testing import setRoles
23from plone .app .testing import SITE_OWNER_NAME
34from plone .app .testing import SITE_OWNER_PASSWORD
45from plone .app .testing import TEST_USER_ID
56from plone .dexterity .utils import createContentInContainer
67from plone .registry .interfaces import IRegistry
78from plone .restapi .bbb import INavigationSchema
8- from plone .restapi .testing import PLONE_RESTAPI_DX_FUNCTIONAL_TESTING
99from plone .restapi .testing import RelativeSession
1010from zope .component import getUtility
1111
1212import transaction
1313import unittest
1414
1515
16+ LANG = "en"
17+
18+
19+ def create (container , portal_type , ** kw ):
20+ content = createContentInContainer (container , portal_type , ** kw )
21+ content .language = LANG
22+ return content
23+
24+
1625class TestServicesNavigation (unittest .TestCase ):
17- layer = PLONE_RESTAPI_DX_FUNCTIONAL_TESTING
26+ layer = FUNCTIONAL_TESTING
1827
1928 def setUp (self ):
2029 self .app = self .layer ["app" ]
2130 self .portal = self .layer ["portal" ]
2231 self .portal_url = self .portal .absolute_url ()
2332 setRoles (self .portal , TEST_USER_ID , ["Manager" ])
2433
34+ # Re-enable Folder type (disabled by plone.volto profile)
35+ fti = self .portal .portal_types ["Folder" ]
36+ fti .global_allow = True
37+
38+ # Ensure Folder is in displayed_types for navigation
39+ registry = getUtility (IRegistry )
40+ settings = registry .forInterface (INavigationSchema , prefix = "plone" )
41+ displayed_types = settings .displayed_types
42+ if "Folder" not in displayed_types :
43+ settings .displayed_types = tuple (list (displayed_types ) + ["Folder" ])
44+
2545 self .api_session = RelativeSession (self .portal_url , test = self )
2646 self .api_session .headers .update ({"Accept" : "application/json" })
2747 self .api_session .auth = (SITE_OWNER_NAME , SITE_OWNER_PASSWORD )
2848
29- self .folder = createContentInContainer (
30- self .portal , "Folder" , id = "folder" , title = "Some Folder"
31- )
32- self .folder2 = createContentInContainer (
49+ self .folder = create (self .portal , "Folder" , id = "folder" , title = "Some Folder" )
50+ self .folder2 = create (
3351 self .portal , "Folder" , id = "folder2" , title = "Some Folder 2"
3452 )
35- self .subfolder1 = createContentInContainer (
53+ self .subfolder1 = create (
3654 self .folder , "Folder" , id = "subfolder1" , title = "SubFolder 1"
3755 )
38- self .subfolder2 = createContentInContainer (
56+ self .subfolder2 = create (
3957 self .folder , "Folder" , id = "subfolder2" , title = "SubFolder 2"
4058 )
41- self .thirdlevelfolder = createContentInContainer (
59+ self .thirdlevelfolder = create (
4260 self .subfolder1 ,
4361 "Folder" ,
4462 id = "thirdlevelfolder" ,
4563 title = "Third Level Folder" ,
4664 )
47- self .fourthlevelfolder = createContentInContainer (
65+ self .fourthlevelfolder = create (
4866 self .thirdlevelfolder ,
4967 "Folder" ,
5068 id = "fourthlevelfolder" ,
5169 title = "Fourth Level Folder" ,
5270 )
53- createContentInContainer (self .folder , "Document" , id = "doc1" , title = "A document" )
71+ create (self .folder , "Document" , id = "doc1" , title = "A document" )
5472 transaction .commit ()
5573
5674 def tearDown (self ):
@@ -93,13 +111,13 @@ def test_dont_broke_with_contents_without_review_state(self):
93111 settings = registry .forInterface (INavigationSchema , prefix = "plone" )
94112 displayed_types = settings .displayed_types
95113 settings .displayed_types = tuple (list (displayed_types ) + ["File" ])
96- createContentInContainer (
114+ create (
97115 self .portal ,
98116 "File" ,
99117 id = "example-file" ,
100118 title = "Example file" ,
101119 )
102- createContentInContainer (
120+ create (
103121 self .folder ,
104122 "File" ,
105123 id = "example-file-1" ,
@@ -123,7 +141,7 @@ def test_show_excluded_items(self):
123141 # False for Plone 6.0 and True for Plone 5.2
124142 # explicitly set the value to False to avoid test failures
125143 settings .show_excluded_items = False
126- createContentInContainer (
144+ create (
127145 self .folder ,
128146 "Folder" ,
129147 id = "excluded-subfolder" ,
@@ -161,13 +179,13 @@ def test_navigation_sorting(self):
161179 "Collection" ,
162180 "File" ,
163181 )
164- createContentInContainer (
182+ create (
165183 self .portal ,
166184 "File" ,
167185 id = "example-file" ,
168186 title = "Example file" ,
169187 )
170- createContentInContainer (
188+ create (
171189 self .folder ,
172190 "File" ,
173191 id = "example-file-1" ,
@@ -208,7 +226,7 @@ def test_use_nav_title_when_available_and_set(self):
208226 title = "Example Document"
209227 nav_title = "Fancy title"
210228
211- createContentInContainer (
229+ create (
212230 self .folder ,
213231 "DXTestDocument" ,
214232 id = "example-dx-document" ,
0 commit comments