Esempio n. 1
0
 def setUp(self):
     super(DeckhandWithDBTestCase, self).setUp()
     self.override_config(
         'connection', os.environ.get('PIFPAF_URL', 'sqlite://'),
         group='database')
     db_api.setup_db()
     self.addCleanup(db_api.drop_db)
Esempio n. 2
0
 def setUp(self):
     super(DeckhandWithDBTestCase, self).setUp()
     if 'PIFPAF_URL' not in os.environ:
         raise RuntimeError('Unit tests must be run using `pifpaf run '
                            'postgresql`.')
     self.override_config('connection',
                          os.environ['PIFPAF_URL'],
                          group='database')
     db_api.setup_db()
     self.addCleanup(db_api.drop_db)
Esempio n. 3
0
def init_application():
    """Main entry point for initializing the Deckhand API service.

    Create routes for the v1.0 API and sets up logging.
    """
    config_files = _get_config_files()
    paste_file = config_files[-1]

    CONF([], project='deckhand', default_config_files=config_files)
    setup_logging(CONF)

    policy.Enforcer(CONF)

    LOG.debug('Starting WSGI application using %s configuration file.',
              paste_file)

    db_api.drop_db()
    db_api.setup_db()

    app = deploy.loadapp('config:%s' % paste_file, name='deckhand_api')
    return app