def setUp(self): self.app = Flask(__name__) load_config_from_file(self.app, "settings.py") self.app.add_url_rule('/', 'index', index) self.app.add_url_rule('/', 'external', external) self.app.add_url_rule( '/somewhere', 'somewhere', )
def test_logging_handler(self): load_config_from_file(self.another_app, "testing.py") logger_init_app(self.another_app) for handler in self.another_app.logger.handlers: try: raise except: formatter = handler.formatter if isinstance(formatter, LocalVarFormatter): formatter.formatException(sys.exc_info())
def test_logging_handler(self): load_config_from_file(self.another_app, "testing.py") init_app(self.another_app) for handler in self.another_app.logger.handlers: try: raise except: formatter = handler.formatter if isinstance(formatter, LocalVarFormatter): formatter.formatException(sys.exc_info())
def setUp(self): self.app = Flask(__name__) load_config_from_file(self.app, 'settings.py') self.app.add_url_rule('/', 'index', index) self.app.add_url_rule('/', 'external', external) self.app.add_url_rule('/somewhere', 'somewhere', )
def test_load_config_from_file_IOError(self): app = Flask(__name__) self.assertFalse(load_config_from_file(app, "notfound.py"))
def test_load_config_from_file(self): load_config_from_file(self.app, "settings.py") self.assertEqual(self.app.config['SETTINGS_KEY'], "settings")
def test_load_config_from_file_ioerror(self): app = Flask(__name__) assert not load_config_from_file(app, "notfound.py")
def test_load_config_from_file(self): load_config_from_file(self.app, "settings.py") assert self.app.config['SETTINGS_KEY'] == "settings"