server/test/unittest_multisources.py
changeset 5557 1a534c596bff
parent 5556 9ab2b4c74baf
child 5590 a56eb02f9ce7
equal deleted inserted replaced
5556:9ab2b4c74baf 5557:1a534c596bff
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    14 # details.
    14 # details.
    15 #
    15 #
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """
       
    19 
       
    20 """
       
    21 from os.path import dirname, join, abspath
    18 from os.path import dirname, join, abspath
    22 from datetime import datetime, timedelta
    19 from datetime import datetime, timedelta
    23 
    20 
    24 from logilab.common.decorators import cached
    21 from logilab.common.decorators import cached
    25 
    22 
   111         rset = self.sexecute('Card X ORDERBY T WHERE X title T')
   108         rset = self.sexecute('Card X ORDERBY T WHERE X title T')
   112         # 2 added to the system source, 2 added to the external source
   109         # 2 added to the system source, 2 added to the external source
   113         self.assertEquals(len(rset), 4)
   110         self.assertEquals(len(rset), 4)
   114         # since they are orderd by eid, we know the 3 first one is coming from the system source
   111         # since they are orderd by eid, we know the 3 first one is coming from the system source
   115         # and the others from external source
   112         # and the others from external source
   116         self.assertEquals(rset.get_entity(0, 0).metainformation(),
   113         self.assertEquals(rset.get_entity(0, 0).cw_metainformation(),
   117                           {'source': {'adapter': 'native', 'uri': 'system'},
   114                           {'source': {'adapter': 'native', 'uri': 'system'},
   118                            'type': u'Card', 'extid': None})
   115                            'type': u'Card', 'extid': None})
   119         externent = rset.get_entity(3, 0)
   116         externent = rset.get_entity(3, 0)
   120         metainf = externent.metainformation()
   117         metainf = externent.cw_metainformation()
   121         self.assertEquals(metainf['source'], {'adapter': 'pyrorql', 'base-url': 'http://extern.org/', 'uri': 'extern'})
   118         self.assertEquals(metainf['source'], {'adapter': 'pyrorql', 'base-url': 'http://extern.org/', 'uri': 'extern'})
   122         self.assertEquals(metainf['type'], 'Card')
   119         self.assertEquals(metainf['type'], 'Card')
   123         self.assert_(metainf['extid'])
   120         self.assert_(metainf['extid'])
   124         etype = self.sexecute('Any ETN WHERE X is ET, ET name ETN, X eid %(x)s',
   121         etype = self.sexecute('Any ETN WHERE X is ET, ET name ETN, X eid %(x)s',
   125                              {'x': externent.eid})[0][0]
   122                              {'x': externent.eid})[0][0]