148 def test_cw_instantiate_relation(self): |
148 def test_cw_instantiate_relation(self): |
149 req = self.request() |
149 req = self.request() |
150 p1 = req.create_entity('Personne', nom=u'di') |
150 p1 = req.create_entity('Personne', nom=u'di') |
151 p2 = req.create_entity('Personne', nom=u'mascio') |
151 p2 = req.create_entity('Personne', nom=u'mascio') |
152 t = req.create_entity('Tag', name=u't0', tags=[]) |
152 t = req.create_entity('Tag', name=u't0', tags=[]) |
153 self.assertItemsEqual(t.tags, []) |
153 self.assertCountEqual(t.tags, []) |
154 t = req.create_entity('Tag', name=u't1', tags=p1) |
154 t = req.create_entity('Tag', name=u't1', tags=p1) |
155 self.assertItemsEqual(t.tags, [p1]) |
155 self.assertCountEqual(t.tags, [p1]) |
156 t = req.create_entity('Tag', name=u't2', tags=p1.eid) |
156 t = req.create_entity('Tag', name=u't2', tags=p1.eid) |
157 self.assertItemsEqual(t.tags, [p1]) |
157 self.assertCountEqual(t.tags, [p1]) |
158 t = req.create_entity('Tag', name=u't3', tags=[p1, p2.eid]) |
158 t = req.create_entity('Tag', name=u't3', tags=[p1, p2.eid]) |
159 self.assertItemsEqual(t.tags, [p1, p2]) |
159 self.assertCountEqual(t.tags, [p1, p2]) |
160 |
160 |
161 def test_cw_instantiate_reverse_relation(self): |
161 def test_cw_instantiate_reverse_relation(self): |
162 req = self.request() |
162 req = self.request() |
163 t1 = req.create_entity('Tag', name=u't1') |
163 t1 = req.create_entity('Tag', name=u't1') |
164 t2 = req.create_entity('Tag', name=u't2') |
164 t2 = req.create_entity('Tag', name=u't2') |
165 p = req.create_entity('Personne', nom=u'di mascio', reverse_tags=t1) |
165 p = req.create_entity('Personne', nom=u'di mascio', reverse_tags=t1) |
166 self.assertItemsEqual(p.reverse_tags, [t1]) |
166 self.assertCountEqual(p.reverse_tags, [t1]) |
167 p = req.create_entity('Personne', nom=u'di mascio', reverse_tags=t1.eid) |
167 p = req.create_entity('Personne', nom=u'di mascio', reverse_tags=t1.eid) |
168 self.assertItemsEqual(p.reverse_tags, [t1]) |
168 self.assertCountEqual(p.reverse_tags, [t1]) |
169 p = req.create_entity('Personne', nom=u'di mascio', reverse_tags=[t1, t2.eid]) |
169 p = req.create_entity('Personne', nom=u'di mascio', reverse_tags=[t1, t2.eid]) |
170 self.assertItemsEqual(p.reverse_tags, [t1, t2]) |
170 self.assertCountEqual(p.reverse_tags, [t1, t2]) |
171 |
171 |
172 def test_fetch_rql(self): |
172 def test_fetch_rql(self): |
173 user = self.user() |
173 user = self.user() |
174 Personne = self.vreg['etypes'].etype_class('Personne') |
174 Personne = self.vreg['etypes'].etype_class('Personne') |
175 Societe = self.vreg['etypes'].etype_class('Societe') |
175 Societe = self.vreg['etypes'].etype_class('Societe') |