server/test/unittest_multisources.py
branchstable
changeset 6758 28b11ecf319b
parent 6631 26c303c3f1aa
child 6762 812445504835
child 6781 5062d86d6ffe
--- a/server/test/unittest_multisources.py	Tue Dec 21 21:20:19 2010 +0100
+++ b/server/test/unittest_multisources.py	Tue Jan 04 09:07:22 2011 +0100
@@ -76,7 +76,9 @@
     TestServerConfiguration.no_sqlite_wrap = False
 
 class TwoSourcesTC(CubicWebTC):
-
+    """Main repo -> extern-multi -> extern
+                  \-------------/
+    """
     @classmethod
     def _refresh_repo(cls):
         super(TwoSourcesTC, cls)._refresh_repo()
@@ -323,6 +325,19 @@
         cu.execute('DELETE Card X WHERE X eid %(x)s', {'x':ceid})
         cnx3.commit()
 
+    def test_crossed_relation_noeid_needattr(self):
+        """http://www.cubicweb.org/ticket/1382452"""
+        aff1 = self.sexecute('INSERT Affaire X: X ref "AFFREF"')[0][0]
+        # link within extern source
+        ec1 = self.sexecute('Card X WHERE X wikiid "zzz"')[0][0]
+        self.sexecute('SET A documented_by C WHERE E eid %(a)s, C eid %(c)s',
+                      {'a': aff1, 'c': ec1})
+        # link from system to extern source
+        self.sexecute('SET A documented_by C WHERE E eid %(a)s, C eid %(c)s',
+                      {'a': aff1, 'c': self.ic2})
+        rset = self.sexecute('DISTINCT Any DEP WHERE P ref "AFFREF", P documented_by DEP, DEP wikiid LIKE "z%"')
+        self.assertEqual(sorted(rset.rows), [[ec1], [self.ic2]])
+
     def test_nonregr1(self):
         ueid = self.session.user.eid
         affaire = self.sexecute('Affaire X WHERE X ref "AFFREF"').get_entity(0, 0)