web/test/unittest_viewselector.py
branch3.0
changeset 431 18b4dd650ef8
parent 0 b97547f5f1fa
child 444 c6f20e605b84
equal deleted inserted replaced
430:6fbc0ab79a2d 431:18b4dd650ef8
     8 from logilab.common.testlib import TestCase, unittest_main
     8 from logilab.common.testlib import TestCase, unittest_main
     9 from cubicweb.devtools.apptest import EnvBasedTC
     9 from cubicweb.devtools.apptest import EnvBasedTC
    10 
    10 
    11 
    11 
    12 from cubicweb import CW_SOFTWARE_ROOT as BASE, Binary
    12 from cubicweb import CW_SOFTWARE_ROOT as BASE, Binary
    13 from cubicweb.common.selectors import in_group_selector
    13 from cubicweb.common.selectors import match_user_group
    14 
    14 
    15 from cubicweb.web._exceptions import NoSelectableObject
    15 from cubicweb.web._exceptions import NoSelectableObject
    16 from cubicweb.web.action import Action
    16 from cubicweb.web.action import Action
    17 from cubicweb.web.views import (baseviews, tableview, baseforms, calendar, 
    17 from cubicweb.web.views import (baseviews, tableview, baseforms, calendar, 
    18                              management, embedding, actions, startup, 
    18                              management, embedding, actions, startup, 
   385         self.assertEquals(self.vreg.property_value('boxes.possible_views_box.order'), 10)
   385         self.assertEquals(self.vreg.property_value('boxes.possible_views_box.order'), 10)
   386         self.assertRaises(KeyError, self.vreg.property_value, 'boxes.actions_box')
   386         self.assertRaises(KeyError, self.vreg.property_value, 'boxes.actions_box')
   387         
   387         
   388 
   388 
   389 
   389 
   390     def test_owners_in_group_selector(self):
   390     def test_owners_match_user_group(self):
   391         """tests usage of 'owners' group with in_group_selector"""
   391         """tests usage of 'owners' group with match_user_group"""
   392         class SomeAction(Action):
   392         class SomeAction(Action):
   393             id = 'yo'
   393             id = 'yo'
   394             category = 'foo'
   394             category = 'foo'
   395             __selectors__ = (in_group_selector,)
   395             __selectors__ = (match_user_group,)
   396             require_groups = ('owners', )            
   396             require_groups = ('owners', )            
   397         self.vreg.register_vobject_class(SomeAction)
   397         self.vreg.register_vobject_class(SomeAction)
   398         self.failUnless(SomeAction in self.vreg['actions']['yo'], self.vreg['actions'])
   398         self.failUnless(SomeAction in self.vreg['actions']['yo'], self.vreg['actions'])
   399         try:
   399         try:
   400             # login as a simple user
   400             # login as a simple user