Beispiel #1
0
 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',
     )
Beispiel #2
0
 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())
Beispiel #3
0
 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())
Beispiel #4
0
 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', )
Beispiel #5
0
 def test_load_config_from_file_IOError(self):
     app = Flask(__name__)
     self.assertFalse(load_config_from_file(app, "notfound.py"))
Beispiel #6
0
 def test_load_config_from_file(self):
     load_config_from_file(self.app, "settings.py")
     self.assertEqual(self.app.config['SETTINGS_KEY'], "settings")
Beispiel #7
0
 def test_load_config_from_file_IOError(self):
     app = Flask(__name__)
     self.assertFalse(load_config_from_file(app, "notfound.py"))
Beispiel #8
0
 def test_load_config_from_file(self):
     load_config_from_file(self.app, "settings.py")
     self.assertEqual(self.app.config['SETTINGS_KEY'], "settings")
Beispiel #9
0
 def test_load_config_from_file_ioerror(self):
     app = Flask(__name__)
     assert not load_config_from_file(app, "notfound.py")
Beispiel #10
0
 def test_load_config_from_file(self):
     load_config_from_file(self.app, "settings.py")
     assert self.app.config['SETTINGS_KEY'] == "settings"