[tests/datafeed] use the new connection api (a small leftover)
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Wed, 04 Jun 2014 15:46:16 +0200
changeset 9860 e24bf60428d3
parent 9859 fc978ff7f381
child 9861 e90ff9d594e5
[tests/datafeed] use the new connection api (a small leftover) Test assertions get indented because of self.session -> scoped cnx.
server/sources/datafeed.py
server/test/unittest_datafeed.py
--- a/server/sources/datafeed.py	Wed Jul 02 18:19:47 2014 +0200
+++ b/server/sources/datafeed.py	Wed Jun 04 15:46:16 2014 +0200
@@ -259,12 +259,12 @@
                 call_hooks('after_add_relation', session,
                            eidfrom=entity.eid, rtype=attr, eidto=value)
 
-    def source_cwuris(self, session):
+    def source_cwuris(self, cnx):
         sql = ('SELECT extid, eid, type FROM entities, cw_source_relation '
                'WHERE entities.eid=cw_source_relation.eid_from '
                'AND cw_source_relation.eid_to=%s' % self.eid)
         return dict((b64decode(uri), (eid, type))
-                    for uri, eid, type in session.system_sql(sql).fetchall())
+                    for uri, eid, type in cnx.system_sql(sql).fetchall())
 
     def init_import_log(self, session, **kwargs):
         dataimport = session.create_entity('CWDataImport', cw_import_of=self,
--- a/server/test/unittest_datafeed.py	Wed Jul 02 18:19:47 2014 +0200
+++ b/server/test/unittest_datafeed.py	Wed Jun 04 15:46:16 2014 +0200
@@ -90,11 +90,11 @@
                 self.assertEqual(self.repo._extid_cache['http://www.cubicweb.org/'],
                                  entity.eid)
 
-        self.assertEqual(dfsource.source_cwuris(self.session),
-                         {'http://www.cubicweb.org/': (entity.eid, 'Card')}
-                         )
-        self.assertTrue(dfsource.latest_retrieval)
-        self.assertTrue(dfsource.fresh())
+                self.assertEqual(dfsource.source_cwuris(cnx),
+                                 {'http://www.cubicweb.org/': (entity.eid, 'Card')}
+                             )
+                self.assertTrue(dfsource.latest_retrieval)
+                self.assertTrue(dfsource.fresh())
 
         # test_rename_source
         with self.admin_access.repo_cnx() as cnx: