server/test/unittest_multisources.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 28 Apr 2010 10:06:01 +0200
branchstable
changeset 5421 8167de96c523
parent 4766 162b2b127b15
child 5423 e15abfdcce38
child 5424 8ecbcbff9777
permissions -rw-r--r--
proper licensing information (LGPL-2.1). Hope I get it right this time.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
     1
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
     2
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
     3
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
     4
# This file is part of CubicWeb.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
     5
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
     6
# CubicWeb is free software: you can redistribute it and/or modify it under the
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
     7
# terms of the GNU Lesser General Public License as published by the Free
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
     8
# Software Foundation, either version 2.1 of the License, or (at your option)
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
     9
# any later version.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
    10
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
    11
# logilab-common is distributed in the hope that it will be useful, but WITHOUT
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
    13
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
    14
# details.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
    15
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
    16
# You should have received a copy of the GNU Lesser General Public License along
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4766
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
1977
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1955
diff changeset
    18
"""
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1955
diff changeset
    19
606923dff11b big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 1955
diff changeset
    20
"""
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    21
from os.path import dirname, join, abspath
1016
26387b836099 use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents: 520
diff changeset
    22
from datetime import datetime, timedelta
26387b836099 use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents: 520
diff changeset
    23
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    24
from logilab.common.decorators import cached
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    25
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    26
from cubicweb.devtools import TestServerConfiguration, init_test_database
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    27
from cubicweb.devtools.testlib import CubicWebTC, refresh_repo
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    28
from cubicweb.devtools.repotest import do_monkey_patch, undo_monkey_patch
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    29
2072
8008e8812d76 deactivate sqlite connection wrapping for unittest_multisources for now
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    30
TestServerConfiguration.no_sqlite_wrap = True
8008e8812d76 deactivate sqlite connection wrapping for unittest_multisources for now
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1977
diff changeset
    31
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    32
class TwoSourcesConfiguration(TestServerConfiguration):
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    33
    sourcefile = 'sources_multi'
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    34
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    35
519
06390418cd9a pyrorql source now ignore external eids which are themselves coming from another external source already in use by the repository (should have the same uri)
sylvain.thenault@logilab.fr
parents: 342
diff changeset
    36
class ExternalSource1Configuration(TestServerConfiguration):
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    37
    sourcefile = 'sources_extern'
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    38
519
06390418cd9a pyrorql source now ignore external eids which are themselves coming from another external source already in use by the repository (should have the same uri)
sylvain.thenault@logilab.fr
parents: 342
diff changeset
    39
class ExternalSource2Configuration(TestServerConfiguration):
06390418cd9a pyrorql source now ignore external eids which are themselves coming from another external source already in use by the repository (should have the same uri)
sylvain.thenault@logilab.fr
parents: 342
diff changeset
    40
    sourcefile = 'sources_multi2'
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    41
1016
26387b836099 use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents: 520
diff changeset
    42
MTIME = datetime.now() - timedelta(0, 10)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    43
repo2, cnx2 = init_test_database(config=ExternalSource1Configuration('data'))
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    44
repo3, cnx3 = init_test_database(config=ExternalSource2Configuration('data'))
519
06390418cd9a pyrorql source now ignore external eids which are themselves coming from another external source already in use by the repository (should have the same uri)
sylvain.thenault@logilab.fr
parents: 342
diff changeset
    45
4691
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    46
# hi-jacking
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    47
from cubicweb.server.sources.pyrorql import PyroRQLSource
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    48
from cubicweb.dbapi import Connection
4691
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    49
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    50
PyroRQLSource_get_connection = PyroRQLSource.get_connection
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    51
Connection_close = Connection.close
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    52
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    53
def setup_module(*args):
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    54
    # hi-jack PyroRQLSource.get_connection to access existing connection (no
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    55
    # pyro connection)
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    56
    PyroRQLSource.get_connection = lambda x: x.uri == 'extern-multi' and cnx3 or cnx2
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    57
    # also necessary since the repository is closing its initial connections
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    58
    # pool though we want to keep cnx2 valid
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    59
    Connection.close = lambda x: None
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    60
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    61
def teardown_module(*args):
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    62
    PyroRQLSource.get_connection = PyroRQLSource_get_connection
ae468fae9965 [test] fix test inter-dependancies pb. Pytest ok in each individual test dir, though not yet for whole cubicweb, but for different reasons
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4252
diff changeset
    63
    Connection.close = Connection_close
4766
162b2b127b15 [test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4691
diff changeset
    64
    global repo2, cnx2, repo3, cnx3
162b2b127b15 [test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4691
diff changeset
    65
    repo2.shutdown()
162b2b127b15 [test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4691
diff changeset
    66
    repo3.shutdown()
162b2b127b15 [test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4691
diff changeset
    67
    del repo2, cnx2, repo3, cnx3
162b2b127b15 [test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4691
diff changeset
    68
    #del TwoSourcesTC.config.vreg
162b2b127b15 [test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4691
diff changeset
    69
    #del TwoSourcesTC.config
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    70
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    71
class TwoSourcesTC(CubicWebTC):
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    72
    config = TwoSourcesConfiguration('data')
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    73
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    74
    @classmethod
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    75
    def _refresh_repo(cls):
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    76
        super(TwoSourcesTC, cls)._refresh_repo()
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    77
        cnx2.rollback()
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    78
        refresh_repo(repo2)
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    79
        cnx3.rollback()
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    80
        refresh_repo(repo3)
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    81
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    82
    def setUp(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    83
        CubicWebTC.setUp(self)
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    84
        do_monkey_patch()
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    85
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    86
    def tearDown(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    87
        CubicWebTC.tearDown(self)
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    88
        undo_monkey_patch()
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    89
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    90
    def setup_database(self):
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    91
        cu = cnx2.cursor()
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    92
        self.ec1 = cu.execute('INSERT Card X: X title "C3: An external card", X wikiid "aaa"')[0][0]
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    93
        cu.execute('INSERT Card X: X title "C4: Ze external card", X wikiid "zzz"')
2968
0e3460341023 somewhat painful backport of 3.5 branch, should mostly be ok
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2773 2920
diff changeset
    94
        self.aff1 = cu.execute('INSERT Affaire X: X ref "AFFREF"')[0][0]
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    95
        cnx2.commit()
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    96
        # trigger discovery
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    97
        self.sexecute('Card X')
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    98
        self.sexecute('Affaire X')
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
    99
        self.sexecute('State X')
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   100
        # add some entities
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   101
        self.ic1 = self.sexecute('INSERT Card X: X title "C1: An internal card", X wikiid "aaai"')[0][0]
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   102
        self.ic2 = self.sexecute('INSERT Card X: X title "C2: Ze internal card", X wikiid "zzzi"')[0][0]
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   103
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   104
    def test_eid_comp(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   105
        rset = self.sexecute('Card X WHERE X eid > 1')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   106
        self.assertEquals(len(rset), 4)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   107
        rset = self.sexecute('Any X,T WHERE X title T, X eid > 1')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   108
        self.assertEquals(len(rset), 4)
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   109
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   110
    def test_metainformation(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   111
        rset = self.sexecute('Card X ORDERBY T WHERE X title T')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   112
        # 2 added to the system source, 2 added to the external source
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   113
        self.assertEquals(len(rset), 4)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   114
        # since they are orderd by eid, we know the 3 first one is coming from the system source
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   115
        # and the others from external source
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   116
        self.assertEquals(rset.get_entity(0, 0).metainformation(),
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   117
                          {'source': {'adapter': 'native', 'uri': 'system'},
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   118
                           'type': u'Card', 'extid': None})
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   119
        externent = rset.get_entity(3, 0)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   120
        metainf = externent.metainformation()
1955
6539ce84f043 fix test
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 1952
diff changeset
   121
        self.assertEquals(metainf['source'], {'adapter': 'pyrorql', 'base-url': 'http://extern.org/', 'uri': 'extern'})
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   122
        self.assertEquals(metainf['type'], 'Card')
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   123
        self.assert_(metainf['extid'])
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   124
        etype = self.sexecute('Any ETN WHERE X is ET, ET name ETN, X eid %(x)s',
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   125
                             {'x': externent.eid}, 'x')[0][0]
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   126
        self.assertEquals(etype, 'Card')
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   127
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   128
    def test_order_limit_offset(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   129
        rsetbase = self.sexecute('Any W,X ORDERBY W,X WHERE X wikiid W')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   130
        self.assertEquals(len(rsetbase), 4)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   131
        self.assertEquals(sorted(rsetbase.rows), rsetbase.rows)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   132
        rset = self.sexecute('Any W,X ORDERBY W,X LIMIT 2 OFFSET 2 WHERE X wikiid W')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   133
        self.assertEquals(rset.rows, rsetbase.rows[2:4])
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   134
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   135
    def test_has_text(self):
519
06390418cd9a pyrorql source now ignore external eids which are themselves coming from another external source already in use by the repository (should have the same uri)
sylvain.thenault@logilab.fr
parents: 342
diff changeset
   136
        self.repo.sources_by_uri['extern'].synchronize(MTIME) # in case fti_update has been run before
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   137
        self.failUnless(self.sexecute('Any X WHERE X has_text "affref"'))
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   138
        self.failUnless(self.sexecute('Affaire X WHERE X has_text "affref"'))
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   139
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   140
    def test_anon_has_text(self):
519
06390418cd9a pyrorql source now ignore external eids which are themselves coming from another external source already in use by the repository (should have the same uri)
sylvain.thenault@logilab.fr
parents: 342
diff changeset
   141
        self.repo.sources_by_uri['extern'].synchronize(MTIME) # in case fti_update has been run before
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   142
        self.sexecute('INSERT Affaire X: X ref "no readable card"')[0][0]
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   143
        aff1 = self.sexecute('INSERT Affaire X: X ref "card"')[0][0]
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   144
        # grant read access
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   145
        self.sexecute('SET X owned_by U WHERE X eid %(x)s, U login "anon"', {'x': aff1}, 'x')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   146
        self.commit()
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   147
        cnx = self.login('anon')
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   148
        cu = cnx.cursor()
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   149
        rset = cu.execute('Any X WHERE X has_text "card"')
519
06390418cd9a pyrorql source now ignore external eids which are themselves coming from another external source already in use by the repository (should have the same uri)
sylvain.thenault@logilab.fr
parents: 342
diff changeset
   150
        self.assertEquals(len(rset), 5, zip(rset.rows, rset.description))
4766
162b2b127b15 [test] get a chance to get proper garbage collection when running pytest on whole cw
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4691
diff changeset
   151
        Connection_close(cnx)
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   152
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   153
    def test_synchronization(self):
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   154
        cu = cnx2.cursor()
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   155
        assert cu.execute('Any X WHERE X eid %(x)s', {'x': self.aff1}, 'x')
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   156
        cu.execute('SET X ref "BLAH" WHERE X eid %(x)s', {'x': self.aff1}, 'x')
2920
64322aa83a1d start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   157
        aff2 = cu.execute('INSERT Affaire X: X ref "AFFREUX"')[0][0]
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   158
        cnx2.commit()
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   159
        try:
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   160
            # force sync
519
06390418cd9a pyrorql source now ignore external eids which are themselves coming from another external source already in use by the repository (should have the same uri)
sylvain.thenault@logilab.fr
parents: 342
diff changeset
   161
            self.repo.sources_by_uri['extern'].synchronize(MTIME)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   162
            self.failUnless(self.sexecute('Any X WHERE X has_text "blah"'))
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   163
            self.failUnless(self.sexecute('Any X WHERE X has_text "affreux"'))
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   164
            cu.execute('DELETE Affaire X WHERE X eid %(x)s', {'x': aff2})
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   165
            cnx2.commit()
519
06390418cd9a pyrorql source now ignore external eids which are themselves coming from another external source already in use by the repository (should have the same uri)
sylvain.thenault@logilab.fr
parents: 342
diff changeset
   166
            self.repo.sources_by_uri['extern'].synchronize(MTIME)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   167
            rset = self.sexecute('Any X WHERE X has_text "affreux"')
519
06390418cd9a pyrorql source now ignore external eids which are themselves coming from another external source already in use by the repository (should have the same uri)
sylvain.thenault@logilab.fr
parents: 342
diff changeset
   168
            self.failIf(rset)
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   169
        finally:
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   170
            # restore state
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   171
            cu.execute('SET X ref "AFFREF" WHERE X eid %(x)s', {'x': self.aff1}, 'x')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   172
            cnx2.commit()
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   173
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   174
    def test_simplifiable_var(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   175
        affeid = self.sexecute('Affaire X WHERE X ref "AFFREF"')[0][0]
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   176
        rset = self.sexecute('Any X,AA,AB WHERE E eid %(x)s, E in_state X, X name AA, X modification_date AB',
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   177
                            {'x': affeid}, 'x')
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   178
        self.assertEquals(len(rset), 1)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   179
        self.assertEquals(rset[0][1], "pitetre")
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   180
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   181
    def test_simplifiable_var_2(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   182
        affeid = self.sexecute('Affaire X WHERE X ref "AFFREF"')[0][0]
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   183
        rset = self.sexecute('Any E WHERE E eid %(x)s, E in_state S, NOT S name "moved"',
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   184
                            {'x': affeid, 'u': self.session.user.eid}, 'x')
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   185
        self.assertEquals(len(rset), 1)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   186
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   187
    def test_sort_func(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   188
        self.sexecute('Affaire X ORDERBY DUMB_SORT(RF) WHERE X ref RF')
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   189
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   190
    def test_sort_func_ambigous(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   191
        self.sexecute('Any X ORDERBY DUMB_SORT(RF) WHERE X title RF')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   192
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   193
    def test_in_eid(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   194
        iec1 = self.repo.extid2eid(self.repo.sources_by_uri['extern'], str(self.ec1),
519
06390418cd9a pyrorql source now ignore external eids which are themselves coming from another external source already in use by the repository (should have the same uri)
sylvain.thenault@logilab.fr
parents: 342
diff changeset
   195
                                   'Card', self.session)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   196
        rset = self.sexecute('Any X WHERE X eid IN (%s, %s)' % (iec1, self.ic1))
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   197
        self.assertEquals(sorted(r[0] for r in rset.rows), sorted([iec1, self.ic1]))
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   198
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   199
    def test_greater_eid(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   200
        rset = self.sexecute('Any X WHERE X eid > %s' % (self.ic1 - 1))
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   201
        self.assertEquals(len(rset.rows), 2) # self.ic1 and self.ic2
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   202
        cu = cnx2.cursor()
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   203
        ec2 = cu.execute('INSERT Card X: X title "glup"')[0][0]
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   204
        cnx2.commit()
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   205
        # 'X eid > something' should not trigger discovery
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   206
        rset = self.sexecute('Any X WHERE X eid > %s' % (self.ic1 - 1))
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   207
        self.assertEquals(len(rset.rows), 2)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   208
        # trigger discovery using another query
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   209
        crset = self.sexecute('Card X WHERE X title "glup"')
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   210
        self.assertEquals(len(crset.rows), 1)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   211
        rset = self.sexecute('Any X WHERE X eid > %s' % (self.ic1 - 1))
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   212
        self.assertEquals(len(rset.rows), 3)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   213
        rset = self.sexecute('Any MAX(X)')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   214
        self.assertEquals(len(rset.rows), 1)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   215
        self.assertEquals(rset.rows[0][0], crset[0][0])
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   216
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   217
    def test_attr_unification_1(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   218
        n1 = self.sexecute('INSERT Note X: X type "AFFREF"')[0][0]
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   219
        n2 = self.sexecute('INSERT Note X: X type "AFFREU"')[0][0]
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   220
        rset = self.sexecute('Any X,Y WHERE X is Note, Y is Affaire, X type T, Y ref T')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   221
        self.assertEquals(len(rset), 1, rset.rows)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   222
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   223
    def test_attr_unification_2(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   224
        cu = cnx2.cursor()
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   225
        ec2 = cu.execute('INSERT Card X: X title "AFFREF"')[0][0]
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   226
        cnx2.commit()
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   227
        try:
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   228
            c1 = self.sexecute('INSERT Card C: C title "AFFREF"')[0][0]
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   229
            rset = self.sexecute('Any X,Y WHERE X is Card, Y is Affaire, X title T, Y ref T')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   230
            self.assertEquals(len(rset), 2, rset.rows)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   231
        finally:
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   232
            cu.execute('DELETE Card X WHERE X eid %(x)s', {'x': ec2}, 'x')
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   233
            cnx2.commit()
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   234
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   235
    def test_attr_unification_neq_1(self):
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   236
        # XXX complete
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   237
        self.sexecute('Any X,Y WHERE X is Note, Y is Affaire, X creation_date D, Y creation_date > D')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   238
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   239
    def test_attr_unification_neq_2(self):
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   240
        # XXX complete
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   241
        self.sexecute('Any X,Y WHERE X is Card, Y is Affaire, X creation_date D, Y creation_date > D')
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   242
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   243
    def test_union(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   244
        afeids = self.sexecute('Affaire X')
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   245
        ueids = self.sexecute('CWUser X')
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   246
        rset = self.sexecute('(Any X WHERE X is Affaire) UNION (Any X WHERE X is CWUser)')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   247
        self.assertEquals(sorted(r[0] for r in rset.rows),
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   248
                          sorted(r[0] for r in afeids + ueids))
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   249
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   250
    def test_subquery1(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   251
        rsetbase = self.sexecute('Any W,X WITH W,X BEING (Any W,X ORDERBY W,X WHERE X wikiid W)')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   252
        self.assertEquals(len(rsetbase), 4)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   253
        self.assertEquals(sorted(rsetbase.rows), rsetbase.rows)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   254
        rset = self.sexecute('Any W,X LIMIT 2 OFFSET 2 WITH W,X BEING (Any W,X ORDERBY W,X WHERE X wikiid W)')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   255
        self.assertEquals(rset.rows, rsetbase.rows[2:4])
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   256
        rset = self.sexecute('Any W,X ORDERBY W,X LIMIT 2 OFFSET 2 WITH W,X BEING (Any W,X WHERE X wikiid W)')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   257
        self.assertEquals(rset.rows, rsetbase.rows[2:4])
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   258
        rset = self.sexecute('Any W,X WITH W,X BEING (Any W,X ORDERBY W,X LIMIT 2 OFFSET 2 WHERE X wikiid W)')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   259
        self.assertEquals(rset.rows, rsetbase.rows[2:4])
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   260
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   261
    def test_subquery2(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   262
        affeid = self.sexecute('Affaire X WHERE X ref "AFFREF"')[0][0]
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   263
        rset = self.sexecute('Any X,AA,AB WITH X,AA,AB BEING (Any X,AA,AB WHERE E eid %(x)s, E in_state X, X name AA, X modification_date AB)',
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   264
                            {'x': affeid})
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   265
        self.assertEquals(len(rset), 1)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   266
        self.assertEquals(rset[0][1], "pitetre")
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   267
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   268
    def test_not_relation(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   269
        states = set(tuple(x) for x in self.sexecute('Any S,SN WHERE S is State, S name SN'))
3252
c0e10da6f1cf tests update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2920
diff changeset
   270
        self.session.user.clear_all_caches()
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   271
        userstate = self.session.user.in_state[0]
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   272
        states.remove((userstate.eid, userstate.name))
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   273
        notstates = set(tuple(x) for x in self.sexecute('Any S,SN WHERE S is State, S name SN, NOT X in_state S, X eid %(x)s',
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   274
                                                       {'x': self.session.user.eid}, 'x'))
3252
c0e10da6f1cf tests update
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2920
diff changeset
   275
        self.assertSetEquals(notstates, states)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   276
        aff1 = self.sexecute('Any X WHERE X is Affaire, X ref "AFFREF"')[0][0]
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   277
        aff1stateeid, aff1statename = self.sexecute('Any S,SN WHERE X eid %(x)s, X in_state S, S name SN', {'x': aff1}, 'x')[0]
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   278
        self.assertEquals(aff1statename, 'pitetre')
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   279
        states.add((userstate.eid, userstate.name))
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   280
        states.remove((aff1stateeid, aff1statename))
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   281
        notstates = set(tuple(x) for x in self.sexecute('Any S,SN WHERE S is State, S name SN, NOT X in_state S, X eid %(x)s',
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   282
                                                       {'x': aff1}, 'x'))
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   283
        self.assertSetEquals(notstates, states)
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   284
1840
f4b5c15d1147 test and fix #342997: local eid used for absolute_url of external entities
sylvain.thenault@logilab.fr
parents: 1786
diff changeset
   285
    def test_absolute_url_base_url(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   286
        cu = cnx2.cursor()
1840
f4b5c15d1147 test and fix #342997: local eid used for absolute_url of external entities
sylvain.thenault@logilab.fr
parents: 1786
diff changeset
   287
        ceid = cu.execute('INSERT Card X: X title "without wikiid to get eid based url"')[0][0]
f4b5c15d1147 test and fix #342997: local eid used for absolute_url of external entities
sylvain.thenault@logilab.fr
parents: 1786
diff changeset
   288
        cnx2.commit()
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   289
        lc = self.sexecute('Card X WHERE X title "without wikiid to get eid based url"').get_entity(0, 0)
1840
f4b5c15d1147 test and fix #342997: local eid used for absolute_url of external entities
sylvain.thenault@logilab.fr
parents: 1786
diff changeset
   290
        self.assertEquals(lc.absolute_url(), 'http://extern.org/card/eid/%s' % ceid)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   291
        cu.execute('DELETE Card X WHERE X eid %(x)s', {'x':ceid})
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   292
        cnx2.commit()
1840
f4b5c15d1147 test and fix #342997: local eid used for absolute_url of external entities
sylvain.thenault@logilab.fr
parents: 1786
diff changeset
   293
f4b5c15d1147 test and fix #342997: local eid used for absolute_url of external entities
sylvain.thenault@logilab.fr
parents: 1786
diff changeset
   294
    def test_absolute_url_no_base_url(self):
f4b5c15d1147 test and fix #342997: local eid used for absolute_url of external entities
sylvain.thenault@logilab.fr
parents: 1786
diff changeset
   295
        cu = cnx3.cursor()
f4b5c15d1147 test and fix #342997: local eid used for absolute_url of external entities
sylvain.thenault@logilab.fr
parents: 1786
diff changeset
   296
        ceid = cu.execute('INSERT Card X: X title "without wikiid to get eid based url"')[0][0]
f4b5c15d1147 test and fix #342997: local eid used for absolute_url of external entities
sylvain.thenault@logilab.fr
parents: 1786
diff changeset
   297
        cnx3.commit()
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   298
        lc = self.sexecute('Card X WHERE X title "without wikiid to get eid based url"').get_entity(0, 0)
1840
f4b5c15d1147 test and fix #342997: local eid used for absolute_url of external entities
sylvain.thenault@logilab.fr
parents: 1786
diff changeset
   299
        self.assertEquals(lc.absolute_url(), 'http://testing.fr/cubicweb/card/eid/%s' % lc.eid)
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   300
        cu.execute('DELETE Card X WHERE X eid %(x)s', {'x':ceid})
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   301
        cnx3.commit()
1840
f4b5c15d1147 test and fix #342997: local eid used for absolute_url of external entities
sylvain.thenault@logilab.fr
parents: 1786
diff changeset
   302
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   303
    def test_nonregr1(self):
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   304
        ueid = self.session.user.eid
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   305
        affaire = self.sexecute('Affaire X WHERE X ref "AFFREF"').get_entity(0, 0)
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   306
        self.sexecute('Any U WHERE U in_group G, (G name IN ("managers", "logilab") OR (X require_permission P?, P name "bla", P require_group G)), X eid %(x)s, U eid %(u)s',
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   307
                     {'x': affaire.eid, 'u': ueid})
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   308
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   309
    def test_nonregr2(self):
2920
64322aa83a1d start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   310
        self.session.user.fire_transition('deactivate')
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   311
        treid = self.session.user.latest_trinfo().eid
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   312
        rset = self.sexecute('Any X ORDERBY D DESC WHERE E eid %(x)s, E wf_info_for X, X modification_date D',
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   313
                            {'x': treid})
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   314
        self.assertEquals(len(rset), 1)
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   315
        self.assertEquals(rset.rows[0], [self.session.user.eid])
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   316
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   317
    def test_nonregr3(self):
2773
b2530e3e0afb [testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 2072
diff changeset
   318
        self.sexecute('DELETE Card X WHERE X eid %(x)s, NOT X multisource_inlined_rel Y', {'x': self.ic1})
1786
eccd1885d42e one more msplanning bug fixed...
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   319
342
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   320
if __name__ == '__main__':
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   321
    from logilab.common.testlib import unittest_main
6becc066fc00 backport unittest_multisources from cubicweb-multisources
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   322
    unittest_main()