def setUp(self): """ Set up anything necessary for all tests """ if not hasattr(self, 'projector'): with patch('openlp.core.lib.projector.db.init_url' ) as mocked_init_url: mocked_init_url.start() mocked_init_url.return_value = 'sqlite:///%s' % tmpfile self.projector = ProjectorDB()
def bootstrap_initialise(self): """ Pre-initialize setups. """ self.setup_ui(self) if self.projectordb is None: # Work around for testing creating a ~/.openlp.data.projector.projector.sql file log.debug('Creating new ProjectorDB() instance') self.projectordb = ProjectorDB() else: log.debug('Using existing ProjectorDB() instance') self.get_settings()
def setUp(self): """ Create the UI and setup necessary options :return: None """ self.build_settings() self.setup_application() Registry.create() with patch('openlp.core.lib.projector.db.init_url') as mocked_init_url: mocked_init_url.return_value = 'sqlite://' self.projectordb = ProjectorDB() self.projector_form = ProjectorEditForm( projectordb=self.projectordb)
def setUp(self): """ Create the UI and setup necessary options """ self.build_settings() self.setup_application() Registry.create() with patch('openlp.core.lib.projector.db.init_url') as mocked_init_url: if os.path.exists(TEST_DB): os.unlink(TEST_DB) mocked_init_url.return_value = 'sqlite:///%s' % TEST_DB self.projectordb = ProjectorDB() if not hasattr(self, 'projector_manager'): self.projector_manager = ProjectorManager( projectordb=self.projectordb)
def setUp(self): """ Create the UI and setup necessary options """ self.build_settings() self.setup_application() Registry.create() if not hasattr(self, 'projector_manager'): with patch('openlp.core.lib.projector.db.init_url' ) as mocked_init_url: mocked_init_url.start() mocked_init_url.return_value = 'sqlite:///%s' % tmpfile self.projectordb = ProjectorDB() if not hasattr(self, 'projector_manager'): self.projector_manager = ProjectorManager( projectordb=self.projectordb)
def setUp(self, mocked_init_url): """ Set up anything necessary for all tests """ mocked_init_url.return_value = 'sqlite:///{}'.format(TEST_DB) self.build_settings() self.setup_application() Registry.create() # Do not try to recreate if we've already been created from a previous test if not hasattr(self, 'projectordb'): self.projectordb = ProjectorDB() # Retrieve/create a database record self.projector = self.projectordb.get_projector_by_ip(TEST1_DATA['ip']) if not self.projector: self.projectordb.add_projector(projector=Projector(**TEST1_DATA)) self.projector = self.projectordb.get_projector_by_ip( TEST1_DATA['ip']) self.projector.dbid = self.projector.id self.projector.db_item = self.projector
def setUp(self, mocked_init_url): """ Set up anything necessary for all tests """ mocked_init_url.return_value = 'sqlite:///{db}'.format(db=TEST_DB) self.projector = ProjectorDB()