equal
deleted
inserted
replaced
182 * `session`, server side session associated to `cnx` |
182 * `session`, server side session associated to `cnx` |
183 * `app`, the cubicweb publisher (for web testing) |
183 * `app`, the cubicweb publisher (for web testing) |
184 * `repo`, the repository object |
184 * `repo`, the repository object |
185 * `admlogin`, login of the admin user |
185 * `admlogin`, login of the admin user |
186 * `admpassword`, password of the admin user |
186 * `admpassword`, password of the admin user |
|
187 * `shell`, create and use shell environment |
187 """ |
188 """ |
188 appid = 'data' |
189 appid = 'data' |
189 configcls = devtools.ApptestConfiguration |
190 configcls = devtools.ApptestConfiguration |
190 reset_schema = reset_vreg = False # reset schema / vreg between tests |
191 reset_schema = reset_vreg = False # reset schema / vreg between tests |
191 tags = TestCase.tags | Tags('cubicweb', 'cw_repo') |
192 tags = TestCase.tags | Tags('cubicweb', 'cw_repo') |
288 |
289 |
289 @property |
290 @property |
290 def adminsession(self): |
291 def adminsession(self): |
291 """return current server side session (using default manager account)""" |
292 """return current server side session (using default manager account)""" |
292 return self.repo._sessions[self._orig_cnx[0].sessionid] |
293 return self.repo._sessions[self._orig_cnx[0].sessionid] |
|
294 |
|
295 def shell(self): |
|
296 """return a shell session object""" |
|
297 from cubicweb.server.migractions import ServerMigrationHelper |
|
298 return ServerMigrationHelper(None, repo=self.repo, cnx=self.cnx, |
|
299 interactive=False, |
|
300 # hack so it don't try to load fs schema |
|
301 schema=1) |
293 |
302 |
294 def set_option(self, optname, value): |
303 def set_option(self, optname, value): |
295 self.config.global_set_option(optname, value) |
304 self.config.global_set_option(optname, value) |
296 |
305 |
297 def set_debug(self, debugmode): |
306 def set_debug(self, debugmode): |
661 |
670 |
662 # content validation ####################################################### |
671 # content validation ####################################################### |
663 |
672 |
664 def assertDocTestFile(self, testfile): |
673 def assertDocTestFile(self, testfile): |
665 # doctest returns tuple (failure_count, test_count) |
674 # doctest returns tuple (failure_count, test_count) |
666 result = self.shell.process_script(testfile) |
675 result = self.shell().process_script(testfile) |
667 if result[0] and result[1]: |
676 if result[0] and result[1]: |
668 raise self.failureException("doctest file '%s' failed" |
677 raise self.failureException("doctest file '%s' failed" |
669 % testfile) |
678 % testfile) |
670 |
679 |
671 # validators are used to validate (XML, DTD, whatever) view's content |
680 # validators are used to validate (XML, DTD, whatever) view's content |