[web/test] Drop folder cube dependency
Copy useful schema bits, define IBreadCrumbs adapter for Folder/fild_under
(previously relying on ITree adapter) and adjust unittest_viewselector tests
to drop a view that does not exist anymore.
Related to #5168939.
--- a/web/test/data/bootstrap_cubes Wed Apr 22 10:08:14 2015 +0200
+++ b/web/test/data/bootstrap_cubes Wed Mar 25 08:21:00 2015 +0100
@@ -1,1 +1,1 @@
-file, blog, tag, folder
+file, blog, tag
--- a/web/test/data/schema.py Wed Apr 22 10:08:14 2015 +0200
+++ b/web/test/data/schema.py Wed Mar 25 08:21:00 2015 +0100
@@ -93,9 +93,9 @@
title = String(maxsize=32, required=True, fulltextindexed=True)
concerns = SubjectRelation('Project', composite='object')
-# used by windmill for `test_edit_relation`
-from cubes.folder.schema import Folder
-
+class Folder(EntityType):
+ name = String(required=True)
+ filed_under = SubjectRelation('Folder', description=_('parent folder'))
class TreeNode(EntityType):
name = String(required=True)
--- a/web/test/data/views.py Wed Apr 22 10:08:14 2015 +0200
+++ b/web/test/data/views.py Wed Mar 25 08:21:00 2015 +0100
@@ -16,7 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
+from cubicweb.predicates import has_related_entities
from cubicweb.web.views.ajaxcontroller import ajaxfunc
+from cubicweb.web.views.ibreadcrumbs import IBreadCrumbsAdapter
def _recursive_replace_stream_by_content(tree):
""" Search for streams (i.e. object that have a 'read' method) in a tree
@@ -46,3 +48,10 @@
except Exception, ex:
import traceback as tb
tb.print_exc(ex)
+
+
+class FolderIBreadCrumbsAdapter(IBreadCrumbsAdapter):
+ __select__ = IBreadCrumbsAdapter.__select__ & has_related_entities('filed_under')
+
+ def parent_entity(self):
+ return self.entity.filed_under[0]
--- a/web/test/unittest_viewselector.py Wed Apr 22 10:08:14 2015 +0200
+++ b/web/test/unittest_viewselector.py Wed Mar 25 08:21:00 2015 +0100
@@ -33,7 +33,6 @@
cwproperties, cwsources, xmlrss, rdf, csvexport, json,
undohistory)
-from cubes.folder import views as folderviews
USERACTIONS = [actions.UserPreferencesAction,
actions.UserInfoAction,
@@ -101,7 +100,6 @@
('schema', schema.SchemaView),
('siteinfo', debug.SiteInfoView),
('systempropertiesform', cwproperties.SystemCWPropertiesForm),
- ('tree', folderviews.FolderTreeView),
('undohistory', undohistory.UndoHistoryView)])
def test_possible_views_noresult(self):