test/unittest_selectors.py
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Mon, 18 May 2009 13:41:53 +0200
branchstable
changeset 1839 2cdd0d1d3888
parent 1640 65b60f177eb1
child 1977 606923dff11b
permissions -rw-r--r--
oops
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
630
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     1
"""unit tests for selectors mechanism
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     2
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     3
:organization: Logilab
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     4
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     5
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     6
"""
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     7
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     8
from logilab.common.testlib import TestCase, unittest_main
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     9
1473
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 779
diff changeset
    10
from cubicweb.devtools.testlib import EnvBasedTC
630
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    11
from cubicweb.vregistry import Selector, AndSelector, OrSelector
1640
65b60f177eb1 fix tests
sylvain.thenault@logilab.fr
parents: 1571
diff changeset
    12
from cubicweb.selectors import implements, match_user_groups
779
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    13
from cubicweb.interfaces import IDownloadable
1571
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
    14
from cubicweb.web import action
630
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    15
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    16
class _1_(Selector):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    17
    def __call__(self, *args, **kwargs):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    18
        return 1
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    19
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    20
class _0_(Selector):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    21
    def __call__(self, *args, **kwargs):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    22
        return 0
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    23
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    24
def _2_(*args, **kwargs):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    25
    return 2
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    26
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    27
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    28
class SelectorsTC(TestCase):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    29
    def test_basic_and(self):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    30
        selector = _1_() & _1_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    31
        self.assertEquals(selector(None), 2)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    32
        selector = _1_() & _0_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    33
        self.assertEquals(selector(None), 0)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    34
        selector = _0_() & _1_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    35
        self.assertEquals(selector(None), 0)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    36
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    37
    def test_basic_or(self):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    38
        selector = _1_() | _1_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    39
        self.assertEquals(selector(None), 1)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    40
        selector = _1_() | _0_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    41
        self.assertEquals(selector(None), 1)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    42
        selector = _0_() | _1_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    43
        self.assertEquals(selector(None), 1)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    44
        selector = _0_() | _0_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    45
        self.assertEquals(selector(None), 0)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    46
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    47
    def test_selector_and_function(self):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    48
        selector = _1_() & _2_
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    49
        self.assertEquals(selector(None), 3)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    50
        selector = _2_ & _1_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    51
        self.assertEquals(selector(None), 3)
1473
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 779
diff changeset
    52
630
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    53
    def test_three_and(self):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    54
        selector = _1_() & _1_() & _1_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    55
        self.assertEquals(selector(None), 3)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    56
        selector = _1_() & _0_() & _1_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    57
        self.assertEquals(selector(None), 0)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    58
        selector = _0_() & _1_() & _1_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    59
        self.assertEquals(selector(None), 0)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    60
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    61
    def test_three_or(self):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    62
        selector = _1_() | _1_() | _1_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    63
        self.assertEquals(selector(None), 1)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    64
        selector = _1_() | _0_() | _1_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    65
        self.assertEquals(selector(None), 1)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    66
        selector = _0_() | _1_() | _1_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    67
        self.assertEquals(selector(None), 1)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    68
        selector = _0_() | _0_() | _0_()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    69
        self.assertEquals(selector(None), 0)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    70
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    71
    def test_composition(self):
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    72
        selector = (_1_() & _1_()) & (_1_() & _1_())
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    73
        self.failUnless(isinstance(selector, AndSelector))
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    74
        self.assertEquals(len(selector.selectors), 4)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    75
        self.assertEquals(selector(None), 4)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    76
        selector = (_1_() & _0_()) | (_1_() & _1_())
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    77
        self.failUnless(isinstance(selector, OrSelector))
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    78
        self.assertEquals(len(selector.selectors), 2)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    79
        self.assertEquals(selector(None), 2)
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    80
779
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    81
    def test_search_selectors(self):
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    82
        sel = implements('something')
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    83
        self.assertIs(sel.search_selector(implements), sel)
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    84
        csel = AndSelector(sel, Selector())
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    85
        self.assertIs(csel.search_selector(implements), sel)
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    86
        csel = AndSelector(Selector(), sel)
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    87
        self.assertIs(csel.search_selector(implements), sel)
1473
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 779
diff changeset
    88
630
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    89
779
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    90
class ImplementsSelectorTC(EnvBasedTC):
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    91
    def test_etype_priority(self):
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    92
        req = self.request()
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    93
        cls = self.vreg.etype_class('File')
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    94
        anyscore = implements('Any').score_class(cls, req)
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    95
        idownscore = implements(IDownloadable).score_class(cls, req)
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    96
        self.failUnless(idownscore > anyscore, (idownscore, anyscore))
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    97
        filescore = implements('File').score_class(cls, req)
8510e14335e1 implements some str, fix implements selector, test and fixes
sylvain.thenault@logilab.fr
parents: 630
diff changeset
    98
        self.failUnless(filescore > idownscore, (filescore, idownscore))
1473
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 779
diff changeset
    99
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 779
diff changeset
   100
    def test_etype_inheritance_no_yams_inheritance(self):
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 779
diff changeset
   101
        cls = self.vreg.etype_class('Personne')
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 779
diff changeset
   102
        self.failIf(implements('Societe').score_class(cls, self.request()))
717dea3362c0 more implements selector tests
sylvain.thenault@logilab.fr
parents: 779
diff changeset
   103
1571
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   104
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   105
class MatchUserGroupsTC(EnvBasedTC):
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   106
    def test_owners_group(self):
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   107
        """tests usage of 'owners' group with match_user_group"""
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   108
        class SomeAction(action.Action):
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   109
            id = 'yo'
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   110
            category = 'foo'
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   111
            __select__ = match_user_groups('owners')
1640
65b60f177eb1 fix tests
sylvain.thenault@logilab.fr
parents: 1571
diff changeset
   112
        self.vreg._loadedmods[__name__] = {}
1571
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   113
        self.vreg.register_vobject_class(SomeAction)
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   114
        self.failUnless(SomeAction in self.vreg['actions']['yo'], self.vreg['actions'])
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   115
        try:
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   116
            # login as a simple user
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   117
            self.create_user('john')
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   118
            self.login('john')
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   119
            # it should not be possible to use SomeAction not owned objects
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   120
            rset, req = self.env.get_rset_and_req('Any G WHERE G is CWGroup, G name "managers"')
1640
65b60f177eb1 fix tests
sylvain.thenault@logilab.fr
parents: 1571
diff changeset
   121
            self.failIf('yo' in dict(self.pactions(req, rset)))
1571
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   122
            # insert a new card, and check that we can use SomeAction on our object
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   123
            self.execute('INSERT Card C: C title "zoubidou"')
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   124
            self.commit()
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   125
            rset, req = self.env.get_rset_and_req('Card C WHERE C title "zoubidou"')
1640
65b60f177eb1 fix tests
sylvain.thenault@logilab.fr
parents: 1571
diff changeset
   126
            self.failUnless('yo' in dict(self.pactions(req, rset)), self.pactions(req, rset))
1571
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   127
            # make sure even managers can't use the action
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   128
            self.restore_connection()
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   129
            rset, req = self.env.get_rset_and_req('Card C WHERE C title "zoubidou"')
1640
65b60f177eb1 fix tests
sylvain.thenault@logilab.fr
parents: 1571
diff changeset
   130
            self.failIf('yo' in dict(self.pactions(req, rset)))
1571
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   131
        finally:
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   132
            del self.vreg[SomeAction.__registry__][SomeAction.id]
e9ad2724659d tests depends on the bootstrap cube
sylvain.thenault@logilab.fr
parents: 1473
diff changeset
   133
630
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   134
if __name__ == '__main__':
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   135
    unittest_main()
66ff0b2f7d03 simple test implementation for binary operators on selectors
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   136