14 from cubicweb.web.views import (primary, baseviews, tableview, editforms, |
14 from cubicweb.web.views import (primary, baseviews, tableview, editforms, |
15 calendar, management, embedding, actions, |
15 calendar, management, embedding, actions, |
16 startup, cwuser, schema, xbel, vcard, owl, |
16 startup, cwuser, schema, xbel, vcard, owl, |
17 treeview, idownloadable, wdoc, debug, |
17 treeview, idownloadable, wdoc, debug, |
18 cwproperties, workflow, xmlrss, csvexport) |
18 cwproperties, workflow, xmlrss, csvexport) |
|
19 |
|
20 from cubes.folder import views as folderviews |
19 |
21 |
20 USERACTIONS = [('myprefs', actions.UserPreferencesAction), |
22 USERACTIONS = [('myprefs', actions.UserPreferencesAction), |
21 ('myinfos', actions.UserInfoAction), |
23 ('myinfos', actions.UserInfoAction), |
22 ('logout', actions.LogoutAction)] |
24 ('logout', actions.LogoutAction)] |
23 SITEACTIONS = [('siteconfig', actions.SiteConfigurationAction), |
25 SITEACTIONS = [('siteconfig', actions.SiteConfigurationAction), |
74 ('manage', startup.ManageView), |
76 ('manage', startup.ManageView), |
75 ('owl', owl.OWLView), |
77 ('owl', owl.OWLView), |
76 ('propertiesform', cwproperties.CWPropertiesForm), |
78 ('propertiesform', cwproperties.CWPropertiesForm), |
77 ('registry', startup.RegistryView), |
79 ('registry', startup.RegistryView), |
78 ('schema', schema.SchemaView), |
80 ('schema', schema.SchemaView), |
79 ('systempropertiesform', cwproperties.SystemCWPropertiesForm)]) |
81 ('systempropertiesform', cwproperties.SystemCWPropertiesForm), |
|
82 ('tree', folderviews.FolderTreeView), |
|
83 ]) |
80 |
84 |
81 def test_possible_views_noresult(self): |
85 def test_possible_views_noresult(self): |
82 rset, req = self.rset_and_req('Any X WHERE X eid 999999') |
86 rset, req = self.rset_and_req('Any X WHERE X eid 999999') |
83 self.assertListEqual(self.pviews(req, rset), |
87 self.assertListEqual(self.pviews(req, rset), |
84 []) |
88 []) |
252 def test_possible_actions_eetype_cwuser_entity(self): |
256 def test_possible_actions_eetype_cwuser_entity(self): |
253 rset, req = self.rset_and_req('CWEType X WHERE X name "CWUser"') |
257 rset, req = self.rset_and_req('CWEType X WHERE X name "CWUser"') |
254 self.assertDictEqual(self.pactions(req, rset), |
258 self.assertDictEqual(self.pactions(req, rset), |
255 {'useractions': USERACTIONS, |
259 {'useractions': USERACTIONS, |
256 'siteactions': SITEACTIONS, |
260 'siteactions': SITEACTIONS, |
257 'mainactions': [('edit', actions.ModifyAction), |
261 'mainactions': [('edit', actions.ModifyAction)], |
258 ('workflow', workflow.ViewWorkflowAction),], |
|
259 'moreactions': [('managepermission', actions.ManagePermissionsAction), |
262 'moreactions': [('managepermission', actions.ManagePermissionsAction), |
|
263 ('addrelated', actions.AddRelatedActions), |
260 ('delete', actions.DeleteAction), |
264 ('delete', actions.DeleteAction), |
261 ('copy', actions.CopyAction), |
265 ('copy', actions.CopyAction), |
262 ], |
266 ], |
263 }) |
267 }) |
264 |
268 |
443 self.assertDictEqual(self.pactions(req, rset), |
447 self.assertDictEqual(self.pactions(req, rset), |
444 {'useractions': USERACTIONS, |
448 {'useractions': USERACTIONS, |
445 'siteactions': SITEACTIONS, |
449 'siteactions': SITEACTIONS, |
446 'mainactions': [('edit', actions.ModifyAction)], |
450 'mainactions': [('edit', actions.ModifyAction)], |
447 'moreactions': [('managepermission', actions.ManagePermissionsAction), |
451 'moreactions': [('managepermission', actions.ManagePermissionsAction), |
|
452 ('addrelated', actions.AddRelatedActions), |
448 ('delete', actions.DeleteAction), |
453 ('delete', actions.DeleteAction), |
449 ('copy', actions.CopyAction), |
454 ('copy', actions.CopyAction), |
450 ('testaction', CWETypeRQLAction), |
455 ('testaction', CWETypeRQLAction), |
451 ], |
456 ], |
452 }) |
457 }) |
454 self.assertDictEqual(self.pactions(req, rset), |
459 self.assertDictEqual(self.pactions(req, rset), |
455 {'useractions': USERACTIONS, |
460 {'useractions': USERACTIONS, |
456 'siteactions': SITEACTIONS, |
461 'siteactions': SITEACTIONS, |
457 'mainactions': [('edit', actions.ModifyAction)], |
462 'mainactions': [('edit', actions.ModifyAction)], |
458 'moreactions': [('managepermission', actions.ManagePermissionsAction), |
463 'moreactions': [('managepermission', actions.ManagePermissionsAction), |
|
464 ('addrelated', actions.AddRelatedActions), |
459 ('delete', actions.DeleteAction), |
465 ('delete', actions.DeleteAction), |
460 ('copy', actions.CopyAction), |
466 ('copy', actions.CopyAction), |
461 ], |
467 ], |
462 }) |
468 }) |
463 |
469 |