server/test/unittest_multisources.py
changeset 6762 812445504835
parent 6724 24bf6f181d0e
parent 6758 28b11ecf319b
child 6782 b5d6f5391695
--- a/server/test/unittest_multisources.py	Sat Dec 18 23:12:14 2010 +0100
+++ b/server/test/unittest_multisources.py	Tue Jan 04 14:11:54 2011 +0100
@@ -86,7 +86,9 @@
     TestServerConfiguration.no_sqlite_wrap = False
 
 class TwoSourcesTC(CubicWebTC):
-
+    """Main repo -> extern-multi -> extern
+                  \-------------/
+    """
     @classmethod
     def _refresh_repo(cls):
         super(TwoSourcesTC, cls)._refresh_repo()
@@ -333,6 +335,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)