devtools/apptest.py
changeset 2476 1294a6bdf3bf
parent 2298 8dffb4cce3b7
child 2591 287e43c6ed81
child 2613 5e19c2bb370e
equal deleted inserted replaced
2475:b6753521129d 2476:1294a6bdf3bf
     1 """This module provides misc utilities to test applications
     1 """This module provides misc utilities to test instances
     2 
     2 
     3 :organization: Logilab
     3 :organization: Logilab
     4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
     6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
     6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
    57 from cubicweb import cwconfig
    57 from cubicweb import cwconfig
    58 cwconfig.SMTP = MockSMTP
    58 cwconfig.SMTP = MockSMTP
    59 
    59 
    60 
    60 
    61 def get_versions(self, checkversions=False):
    61 def get_versions(self, checkversions=False):
    62     """return the a dictionary containing cubes used by this application
    62     """return the a dictionary containing cubes used by this instance
    63     as key with their version as value, including cubicweb version. This is a
    63     as key with their version as value, including cubicweb version. This is a
    64     public method, not requiring a session id.
    64     public method, not requiring a session id.
    65 
    65 
    66     replace Repository.get_versions by this method if you don't want versions
    66     replace Repository.get_versions by this method if you don't want versions
    67     checking
    67     checking
   404         assert self.session.id == self.cnxid
   404         assert self.session.id == self.cnxid
   405         rset = self.__execute(self.cnxid, rql, args, eid_key)
   405         rset = self.__execute(self.cnxid, rql, args, eid_key)
   406         rset.vreg = self.vreg
   406         rset.vreg = self.vreg
   407         rset.req = self.session
   407         rset.req = self.session
   408         # call to set_pool is necessary to avoid pb when using
   408         # call to set_pool is necessary to avoid pb when using
   409         # application entities for convenience
   409         # instance entities for convenience
   410         self.session.set_pool()
   410         self.session.set_pool()
   411         return rset
   411         return rset
   412 
   412 
   413     def commit(self):
   413     def commit(self):
   414         self.__commit(self.cnxid)
   414         self.__commit(self.cnxid)