web/test/unittest_viewselector.py
branchstable
changeset 8743 27a83746aebd
parent 8696 0bb18407c053
child 8908 1eefbe171b59
equal deleted inserted replaced
8742:bd374bd906f3 8743:27a83746aebd
    37 USERACTIONS = [actions.UserPreferencesAction,
    37 USERACTIONS = [actions.UserPreferencesAction,
    38                actions.UserInfoAction,
    38                actions.UserInfoAction,
    39                actions.LogoutAction]
    39                actions.LogoutAction]
    40 SITEACTIONS = [actions.ManageAction]
    40 SITEACTIONS = [actions.ManageAction]
    41 FOOTERACTIONS = [wdoc.HelpAction,
    41 FOOTERACTIONS = [wdoc.HelpAction,
    42                  wdoc.ChangeLogAction,
       
    43                  wdoc.AboutAction,
    42                  wdoc.AboutAction,
    44                  actions.PoweredByAction]
    43                  actions.PoweredByAction]
    45 MANAGEACTIONS = [actions.SiteConfigurationAction,
    44 MANAGEACTIONS = [actions.SiteConfigurationAction,
    46                  schema.ViewSchemaAction,
    45                  schema.ViewSchemaAction,
    47                  cwuser.ManageUsersAction,
    46                  cwuser.ManageUsersAction,
    77             return
    76             return
    78         if registry == 'hooks':
    77         if registry == 'hooks':
    79             self.assertEqual(len(content), expected, content)
    78             self.assertEqual(len(content), expected, content)
    80             return
    79             return
    81         try:
    80         try:
    82             self.assertSetEqual(content.keys(), expected)
    81             self.assertSetEqual(list(content), expected)
    83         except Exception:
    82         except Exception:
    84             print registry, sorted(expected), sorted(content.keys())
    83             print registry, sorted(expected), sorted(content)
    85             print 'no more', [v for v in expected if not v in content.keys()]
    84             print 'no more', [v for v in expected if not v in content]
    86             print 'missing', [v for v in content.keys() if not v in expected]
    85             print 'missing', [v for v in content if not v in expected]
    87             raise
    86             raise
    88 
    87 
    89     def setUp(self):
    88     def setUp(self):
    90         super(VRegistryTC, self).setUp()
    89         super(VRegistryTC, self).setUp()
    91         assert self.vreg['views']['propertiesform']
    90         assert self.vreg['views']['propertiesform']
    92 
    91 
    93     def test_possible_views_none_rset(self):
    92     def test_possible_views_none_rset(self):
    94         req = self.request()
    93         req = self.request()
    95         self.assertListEqual(self.pviews(req, None),
    94         self.assertListEqual(self.pviews(req, None),
    96                              [('changelog', wdoc.ChangeLogView),
    95                              [('cw.sources-management', cwsources.CWSourcesManagementView),
    97                               ('cw.sources-management', cwsources.CWSourcesManagementView),
       
    98                               ('cw.users-and-groups-management', cwuser.UsersAndGroupsManagementView),
    96                               ('cw.users-and-groups-management', cwuser.UsersAndGroupsManagementView),
    99                               ('gc', debug.GCView),
    97                               ('gc', debug.GCView),
   100                               ('index', startup.IndexView),
    98                               ('index', startup.IndexView),
   101                               ('info', debug.ProcessInformationView),
    99                               ('info', debug.ProcessInformationView),
   102                               ('manage', startup.ManageView),
   100                               ('manage', startup.ManageView),
   486             ):
   484             ):
   487             self._test_view(vid, rql, args)
   485             self._test_view(vid, rql, args)
   488 
   486 
   489 
   487 
   490     def test_properties(self):
   488     def test_properties(self):
   491         self.assertEqual(sorted(k for k in self.vreg['propertydefs'].keys()
   489         self.assertEqual(sorted(k for k in self.vreg['propertydefs'].iterkeys()
   492                                  if k.startswith('ctxcomponents.edit_box')),
   490                                 if k.startswith('ctxcomponents.edit_box')),
   493                           ['ctxcomponents.edit_box.context',
   491                          ['ctxcomponents.edit_box.context',
   494                            'ctxcomponents.edit_box.order',
   492                           'ctxcomponents.edit_box.order',
   495                            'ctxcomponents.edit_box.visible'])
   493                           'ctxcomponents.edit_box.visible'])
   496         self.assertEqual([k for k in self.vreg['propertyvalues'].keys()
   494         self.assertEqual([k for k in self.vreg['propertyvalues'].iterkeys()
   497                            if not k.startswith('system.version')],
   495                           if not k.startswith('system.version')],
   498                           [])
   496                          [])
   499         self.assertEqual(self.vreg.property_value('ctxcomponents.edit_box.visible'), True)
   497         self.assertEqual(self.vreg.property_value('ctxcomponents.edit_box.visible'), True)
   500         self.assertEqual(self.vreg.property_value('ctxcomponents.edit_box.order'), 2)
   498         self.assertEqual(self.vreg.property_value('ctxcomponents.edit_box.order'), 2)
   501         self.assertEqual(self.vreg.property_value('ctxcomponents.possible_views_box.visible'), False)
   499         self.assertEqual(self.vreg.property_value('ctxcomponents.possible_views_box.visible'), False)
   502         self.assertEqual(self.vreg.property_value('ctxcomponents.possible_views_box.order'), 10)
   500         self.assertEqual(self.vreg.property_value('ctxcomponents.possible_views_box.order'), 10)
   503         self.assertRaises(UnknownProperty, self.vreg.property_value, 'ctxcomponents.actions_box')
   501         self.assertRaises(UnknownProperty, self.vreg.property_value, 'ctxcomponents.actions_box')