64 guests, managers = [eid for eid, in self.execute('CWGroup G ORDERBY GN ' |
64 guests, managers = [eid for eid, in self.execute('CWGroup G ORDERBY GN ' |
65 'WHERE G name GN, G name IN ("guests", "managers")')] |
65 'WHERE G name GN, G name IN ("guests", "managers")')] |
66 self.assertEqual(f.vocabulary(), |
66 self.assertEqual(f.vocabulary(), |
67 [(u'guests', guests), (u'managers', managers)]) |
67 [(u'guests', guests), (u'managers', managers)]) |
68 # ensure rqlst is left unmodified |
68 # ensure rqlst is left unmodified |
69 self.assertEqual(rqlst.as_string(), 'DISTINCT Any GROUPBY X WHERE X in_group G?, G name GN, NOT G name "users"') |
69 self.assertEqual(rqlst.as_string(), 'DISTINCT Any WHERE X in_group G?, G name GN, NOT G name "users"') |
70 #rqlst = rset.syntax_tree() |
70 #rqlst = rset.syntax_tree() |
71 self.assertEqual(sorted(f.possible_values()), |
71 self.assertEqual(sorted(f.possible_values()), |
72 [str(guests), str(managers)]) |
72 [str(guests), str(managers)]) |
73 # ensure rqlst is left unmodified |
73 # ensure rqlst is left unmodified |
74 self.assertEqual(rqlst.as_string(), 'DISTINCT Any GROUPBY X WHERE X in_group G?, G name GN, NOT G name "users"') |
74 self.assertEqual(rqlst.as_string(), 'DISTINCT Any WHERE X in_group G?, G name GN, NOT G name "users"') |
75 req.form[f.__regid__] = str(guests) |
75 req.form[f.__regid__] = str(guests) |
76 f.add_rql_restrictions() |
76 f.add_rql_restrictions() |
77 # selection is cluttered because rqlst has been prepared for facet (it |
77 # selection is cluttered because rqlst has been prepared for facet (it |
78 # is not in real life) |
78 # is not in real life) |
79 self.assertEqual(f.rqlst.as_string(), |
79 self.assertEqual(f.select.as_string(), |
80 'DISTINCT Any GROUPBY X WHERE X in_group G?, G name GN, NOT G name "users", X in_group D, D eid %s' % guests) |
80 'DISTINCT Any WHERE X in_group G?, G name GN, NOT G name "users", X in_group D, D eid %s' % guests) |
81 |
81 |
82 def test_relation_no_relation_1(self): |
82 def test_relation_no_relation_1(self): |
83 f, (guests, managers) = self._in_group_facet(no_relation=True) |
83 f, (guests, managers) = self._in_group_facet(no_relation=True) |
84 self.assertEqual(f.vocabulary(), |
84 self.assertEqual(f.vocabulary(), |
85 [(u'guests', guests), (u'managers', managers)]) |
85 [(u'guests', guests), (u'managers', managers)]) |