def prepare_test(self): """Prepares to run a standalone test. This initializes Stoq and creates a store and returns an example creator. :returns: an :py:class:`~stoqlib.domain.exampledata.ExampleCreator` """ # FIXME: We need to move this into stoqlib from stoq.gui.shell.bootstrap import boot_shell from stoq.lib.options import get_option_parser parser = get_option_parser() options = parser.parse_args(sys.argv[1:])[0] options.wizard = False options.splashscreen = False options.autoreload = False options.login_username = u'admin' options.non_fatal_warnings = False shell = boot_shell(options, initial=False) shell._dbconn.connect() shell._do_login() from stoqlib.domain.exampledata import ExampleCreator ec = ExampleCreator() store = self.new_store() ec.set_store(store) return ec
def example_creator(store, current_station, current_user, current_branch): creator = ExampleCreator() creator.set_store(store) creator.current_station = current_station creator.current_user = current_user creator.current_branch = current_branch return creator
def __init__(self, test): unittest.TestCase.__init__(self, test) ExampleCreator.__init__(self)
def _create_person_facet(self): return ExampleCreator.create(self.store, self.facet.__name__)