Beispiel #1
0
 def test_log_config_file(self):
     with mock.patch('logging.config.fileConfig') as fc_mock:
         options = {
             'log': {
                 'conf_file': '/some/path'
             },
         }
         conf = config.Config(**options)
         log.init(conf)
         fc_mock.assert_called_once_with('/some/path')
Beispiel #2
0
 def test_null_logger_removed_from_root(self):
     sh = logging.StreamHandler(sys.stderr)
     nh = logging.NullHandler()
     rl = logging.getLogger()
     rl.setLevel(logging.DEBUG)
     rl.addHandler(nh)
     rl.addHandler(sh)
     self.assertThat(rl.handlers, matchers.Contains(nh))
     self.assertThat(rl.handlers, matchers.Contains(sh))
     conf = config.Config()
     log.init(conf)
     self.assertThat(rl.handlers, matchers.Not(matchers.Contains(nh)))
     self.assertThat(rl.handlers, matchers.Contains(sh))
Beispiel #3
0
def wsgi_app(**options):
    """
    Returns a WSGI application that may be served in a container
    or web server

    :param **config: Configuration options for the app.
    """
    conf = config.init(**options)
    log.init(conf)
    store.Store(conf).init()
    app = falcon.API(before=[context.assure_context])
    add_routes(app, conf)
    return app