test/unittest_entity.py
branchstable
changeset 3672 554a588ffaea
parent 3670 b7ec030a5e10
child 3674 387d51af966d
child 3689 deb13e88e037
--- a/test/unittest_entity.py	Wed Oct 14 17:45:49 2009 +0200
+++ b/test/unittest_entity.py	Thu Oct 15 10:13:52 2009 +0200
@@ -192,7 +192,19 @@
         Personne.fetch_attrs, Personne.fetch_order = fetch_config(('nom', ))
         # XXX
         self.assertEquals(p.related_rql('evaluee'),
-                          'Any X,AA ORDERBY Z DESC WHERE X modification_date Z, E eid %(x)s, E evaluee X, X modification_date AA')
+                          'Any X,AA ORDERBY Z DESC '
+                          'WHERE X modification_date Z, E eid %(x)s, E evaluee X, '
+                          'X modification_date AA')
+
+        tag = self.vreg['etypes'].etype_class('Tag')(self.request())
+        self.assertEquals(tag.related_rql('tags', 'subject'),
+                          'Any X,AA ORDERBY Z DESC '
+                          'WHERE X modification_date Z, E eid %(x)s, E tags X, '
+                          'X modification_date AA')
+        self.assertEquals(tag.related_rql('tags', 'subject', ('Personne',)),
+                          'Any X,AA,AB ORDERBY AA ASC '
+                          'WHERE E eid %(x)s, E tags XE is IN (Personne), X nom AA, '
+                          'X modification_date AB')
 
     def test_unrelated_rql_security_1(self):
         user = self.request().user