web/test/unittest_viewselector.py
branchtls-sprint
changeset 635 305da8d6aa2d
parent 587 c8ff5d88f164
child 688 cddfbdee0eb3
equal deleted inserted replaced
634:0badd061ce0f 635:305da8d6aa2d
     7 from logilab.common.testlib import TestCase, unittest_main
     7 from logilab.common.testlib import TestCase, unittest_main
     8 from cubicweb.devtools.apptest import EnvBasedTC
     8 from cubicweb.devtools.apptest import EnvBasedTC
     9 
     9 
    10 
    10 
    11 from cubicweb import CW_SOFTWARE_ROOT as BASE, Binary
    11 from cubicweb import CW_SOFTWARE_ROOT as BASE, Binary
    12 from cubicweb.common.selectors import match_user_group
    12 from cubicweb.common.selectors import match_user_groups
    13 
    13 
    14 from cubicweb.web._exceptions import NoSelectableObject
    14 from cubicweb.web._exceptions import NoSelectableObject
    15 from cubicweb.web.action import Action
    15 from cubicweb.web.action import Action
    16 from cubicweb.web.views import (baseviews, tableview, baseforms, calendar, 
    16 from cubicweb.web.views import (baseviews, tableview, baseforms, calendar, 
    17                                 management, embedding, actions, startup, 
    17                                 management, embedding, actions, startup, 
   409     def test_owners_match_user_group(self):
   409     def test_owners_match_user_group(self):
   410         """tests usage of 'owners' group with match_user_group"""
   410         """tests usage of 'owners' group with match_user_group"""
   411         class SomeAction(Action):
   411         class SomeAction(Action):
   412             id = 'yo'
   412             id = 'yo'
   413             category = 'foo'
   413             category = 'foo'
   414             __selectors__ = (match_user_group,)
   414             __selectors__ = (match_user_groups('owners'),)
   415             require_groups = ('owners', )            
       
   416         self.vreg.register_vobject_class(SomeAction)
   415         self.vreg.register_vobject_class(SomeAction)
   417         self.failUnless(SomeAction in self.vreg['actions']['yo'], self.vreg['actions'])
   416         self.failUnless(SomeAction in self.vreg['actions']['yo'], self.vreg['actions'])
   418         try:
   417         try:
   419             # login as a simple user
   418             # login as a simple user
   420             self.create_user('john')
   419             self.create_user('john')