server/test/unittest_multisources.py
branchstable
changeset 1840 f4b5c15d1147
parent 1786 eccd1885d42e
child 1903 c30034fe074f
equal deleted inserted replaced
1839:2cdd0d1d3888 1840:f4b5c15d1147
   233         self.assertEquals(aff1statename, 'pitetre')
   233         self.assertEquals(aff1statename, 'pitetre')
   234         states.add((userstate.eid, userstate.name))
   234         states.add((userstate.eid, userstate.name))
   235         states.remove((aff1stateeid, aff1statename))
   235         states.remove((aff1stateeid, aff1statename))
   236         notstates = set(tuple(x) for x in self.execute('Any S,SN WHERE S is State, S name SN, NOT X in_state S, X eid %(x)s',
   236         notstates = set(tuple(x) for x in self.execute('Any S,SN WHERE S is State, S name SN, NOT X in_state S, X eid %(x)s',
   237                                                        {'x': aff1}, 'x'))
   237                                                        {'x': aff1}, 'x'))
   238         self.set_debug(False)
       
   239         self.assertSetEquals(notstates, states)
   238         self.assertSetEquals(notstates, states)
       
   239 
       
   240     def test_absolute_url_base_url(self):
       
   241         ceid = cu.execute('INSERT Card X: X title "without wikiid to get eid based url"')[0][0]
       
   242         cnx2.commit()
       
   243         lc = self.execute('Card X WHERE X title "without wikiid to get eid based url"').get_entity(0, 0)
       
   244         self.assertEquals(lc.absolute_url(), 'http://extern.org/card/eid/%s' % ceid)
       
   245 
       
   246     def test_absolute_url_no_base_url(self):
       
   247         cu = cnx3.cursor()
       
   248         ceid = cu.execute('INSERT Card X: X title "without wikiid to get eid based url"')[0][0]
       
   249         cnx3.commit()
       
   250         lc = self.execute('Card X WHERE X title "without wikiid to get eid based url"').get_entity(0, 0)
       
   251         self.assertEquals(lc.absolute_url(), 'http://testing.fr/cubicweb/card/eid/%s' % lc.eid)
   240 
   252 
   241     def test_nonregr1(self):
   253     def test_nonregr1(self):
   242         ueid = self.session.user.eid
   254         ueid = self.session.user.eid
   243         affaire = self.execute('Affaire X WHERE X ref "AFFREF"').get_entity(0, 0)
   255         affaire = self.execute('Affaire X WHERE X ref "AFFREF"').get_entity(0, 0)
   244         self.execute('Any U WHERE U in_group G, (G name IN ("managers", "logilab") OR (X require_permission P?, P name "bla", P require_group G)), X eid %(x)s, U eid %(u)s',
   256         self.execute('Any U WHERE U in_group G, (G name IN ("managers", "logilab") OR (X require_permission P?, P name "bla", P require_group G)), X eid %(x)s, U eid %(u)s',
   249         rset = self.execute('Any X ORDERBY D DESC WHERE E eid %(x)s, E wf_info_for X, X modification_date D',
   261         rset = self.execute('Any X ORDERBY D DESC WHERE E eid %(x)s, E wf_info_for X, X modification_date D',
   250                             {'x': treid})
   262                             {'x': treid})
   251         self.assertEquals(len(rset), 1)
   263         self.assertEquals(len(rset), 1)
   252         self.assertEquals(rset.rows[0], [self.session.user.eid])
   264         self.assertEquals(rset.rows[0], [self.session.user.eid])
   253 
   265 
   254 
       
   255     def test_nonregr3(self):
   266     def test_nonregr3(self):
   256         self.execute('DELETE Card X WHERE X eid %(x)s, NOT X multisource_inlined_rel Y', {'x': self.ic1})
   267         self.execute('DELETE Card X WHERE X eid %(x)s, NOT X multisource_inlined_rel Y', {'x': self.ic1})
   257 
   268 
   258 if __name__ == '__main__':
   269 if __name__ == '__main__':
   259     from logilab.common.testlib import unittest_main
   270     from logilab.common.testlib import unittest_main