devtools/testlib.py
changeset 8562 0d2fb4604265
parent 8543 b7c9443d8625
child 8645 310040c668c0
equal deleted inserted replaced
8561:77ea3eed9946 8562:0d2fb4604265
    45 
    45 
    46 from cubicweb import ValidationError, NoSelectableObject, AuthenticationError
    46 from cubicweb import ValidationError, NoSelectableObject, AuthenticationError
    47 from cubicweb import cwconfig, dbapi, devtools, web, server
    47 from cubicweb import cwconfig, dbapi, devtools, web, server
    48 from cubicweb.sobjects import notification
    48 from cubicweb.sobjects import notification
    49 from cubicweb.web import Redirect, application
    49 from cubicweb.web import Redirect, application
    50 from cubicweb.server.session import Session, security_enabled
    50 from cubicweb.server.session import Session
    51 from cubicweb.server.hook import SendMailOp
    51 from cubicweb.server.hook import SendMailOp
    52 from cubicweb.devtools import SYSTEM_ENTITIES, SYSTEM_RELATIONS, VIEW_VALIDATORS
    52 from cubicweb.devtools import SYSTEM_ENTITIES, SYSTEM_RELATIONS, VIEW_VALIDATORS
    53 from cubicweb.devtools import BASE_URL, fake, htmlparser, DEFAULT_EMPTY_DB_ID
    53 from cubicweb.devtools import BASE_URL, fake, htmlparser, DEFAULT_EMPTY_DB_ID
    54 from cubicweb.utils import json
    54 from cubicweb.utils import json
    55 
    55 
  1048     @nocoverage
  1048     @nocoverage
  1049     def auto_populate(self, how_many):
  1049     def auto_populate(self, how_many):
  1050         """this method populates the database with `how_many` entities
  1050         """this method populates the database with `how_many` entities
  1051         of each possible type. It also inserts random relations between them
  1051         of each possible type. It also inserts random relations between them
  1052         """
  1052         """
  1053         with security_enabled(self.session, read=False, write=False):
  1053         with self.session.security_enabled(read=False, write=False):
  1054             self._auto_populate(how_many)
  1054             self._auto_populate(how_many)
  1055 
  1055 
  1056     def _auto_populate(self, how_many):
  1056     def _auto_populate(self, how_many):
  1057         cu = self.cursor()
  1057         cu = self.cursor()
  1058         self.custom_populate(how_many, cu)
  1058         self.custom_populate(how_many, cu)