server/test/unittest_multisources.py
changeset 6762 812445504835
parent 6724 24bf6f181d0e
parent 6758 28b11ecf319b
child 6782 b5d6f5391695
equal deleted inserted replaced
6751:02091c91520f 6762:812445504835
    84     #del TwoSourcesTC.config.vreg
    84     #del TwoSourcesTC.config.vreg
    85     #del TwoSourcesTC.config
    85     #del TwoSourcesTC.config
    86     TestServerConfiguration.no_sqlite_wrap = False
    86     TestServerConfiguration.no_sqlite_wrap = False
    87 
    87 
    88 class TwoSourcesTC(CubicWebTC):
    88 class TwoSourcesTC(CubicWebTC):
    89 
    89     """Main repo -> extern-multi -> extern
       
    90                   \-------------/
       
    91     """
    90     @classmethod
    92     @classmethod
    91     def _refresh_repo(cls):
    93     def _refresh_repo(cls):
    92         super(TwoSourcesTC, cls)._refresh_repo()
    94         super(TwoSourcesTC, cls)._refresh_repo()
    93         cnx2.rollback()
    95         cnx2.rollback()
    94         refresh_repo(repo2)
    96         refresh_repo(repo2)
   331         lc = self.sexecute('Card X WHERE X title "without wikiid to get eid based url"').get_entity(0, 0)
   333         lc = self.sexecute('Card X WHERE X title "without wikiid to get eid based url"').get_entity(0, 0)
   332         self.assertEqual(lc.absolute_url(), 'http://testing.fr/cubicweb/card/eid/%s' % lc.eid)
   334         self.assertEqual(lc.absolute_url(), 'http://testing.fr/cubicweb/card/eid/%s' % lc.eid)
   333         cu.execute('DELETE Card X WHERE X eid %(x)s', {'x':ceid})
   335         cu.execute('DELETE Card X WHERE X eid %(x)s', {'x':ceid})
   334         cnx3.commit()
   336         cnx3.commit()
   335 
   337 
       
   338     def test_crossed_relation_noeid_needattr(self):
       
   339         """http://www.cubicweb.org/ticket/1382452"""
       
   340         aff1 = self.sexecute('INSERT Affaire X: X ref "AFFREF"')[0][0]
       
   341         # link within extern source
       
   342         ec1 = self.sexecute('Card X WHERE X wikiid "zzz"')[0][0]
       
   343         self.sexecute('SET A documented_by C WHERE E eid %(a)s, C eid %(c)s',
       
   344                       {'a': aff1, 'c': ec1})
       
   345         # link from system to extern source
       
   346         self.sexecute('SET A documented_by C WHERE E eid %(a)s, C eid %(c)s',
       
   347                       {'a': aff1, 'c': self.ic2})
       
   348         rset = self.sexecute('DISTINCT Any DEP WHERE P ref "AFFREF", P documented_by DEP, DEP wikiid LIKE "z%"')
       
   349         self.assertEqual(sorted(rset.rows), [[ec1], [self.ic2]])
       
   350 
   336     def test_nonregr1(self):
   351     def test_nonregr1(self):
   337         ueid = self.session.user.eid
   352         ueid = self.session.user.eid
   338         affaire = self.sexecute('Affaire X WHERE X ref "AFFREF"').get_entity(0, 0)
   353         affaire = self.sexecute('Affaire X WHERE X ref "AFFREF"').get_entity(0, 0)
   339         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',
   354         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',
   340                      {'x': affaire.eid, 'u': ueid})
   355                      {'x': affaire.eid, 'u': ueid})