def test_app_port(self): """ Checks if the app port is set correctly. """ # Loading file from test/resources/session/file/conf/firenado.yml chdir_app("file", "session") self.assertTrue(firenado.conf.app['socket'] is None) self.assertEqual(firenado.conf.app['port'], 8887)
def test_yml_loaded(self): """ On an application with a yml and yaml config files the yml should be loaded. """ chdir_app("yml", "conf") self.assertEqual("yml", _file.get_file_extension( firenado.conf.APP_CONFIG_FILE))
def test_yml_loaded(self): """ On an application with a yml and yaml config files the yml should be loaded. """ chdir_app("yml", "conf") self.assertEqual("yml", fs.get_file_extension( firenado.conf.APP_CONFIG_FILE))
def test_app_addresses_from_conf(self): """ Getting localhost defined into the configuration. """ # At the conf/root_url app.addresses has only localhost chdir_app("root_url", "conf") self.assertTrue(firenado.conf.app['socket'] is None) self.assertEqual(len(firenado.conf.app['addresses']), 1) self.assertEqual(firenado.conf.app['addresses'][0], "localhost")
def test_app_stack(self): """ Application config is provided. Test if the app config file was loaded. """ chdir_app("yml", "conf") self.assertEqual(firenado.conf.stack[0], firenado.conf.LIB_CONFIG_FILE) self.assertEqual(firenado.conf.stack[1], firenado.conf.APP_CONFIG_FILE)
def test_app_addresses_default(self): """ If no addresses are provided to the application we default to ipv4 and ipv6 loopbacks. """ # There is no addresses configured into the conf/yml firenado.yml chdir_app("yml", "conf") self.assertTrue(firenado.conf.app['socket'] is None) self.assertEqual(len(firenado.conf.app['addresses']), 2) self.assertEqual(firenado.conf.app['addresses'][0], "::") self.assertEqual(firenado.conf.app['addresses'][1], "0.0.0.0")
def test_settings(self): """ If no app settings is defined an empty dict is set. """ chdir_app("settings", "conf") settings_dict = { 'cookie_secret': "cookie---secret", 'debug': True, 'xsrf_cookies': True } self.assertDictEqual(settings_dict, firenado.conf.app['settings'])
def setUp(self): """ Application configuration file will be read and components will be loaded. """ chdir_app('file', 'session') self.application = TornadoApplication() self.session_handler_config = firenado.conf.session[ 'handlers'][firenado.conf.session['type']] self.session_handler_config = firenado.conf.session[ 'handlers'][firenado.conf.session['type']] self.session_handler_class = get_class_from_config( self.session_handler_config)
def setUp(self): """ Application configuration file will be read and components will be loaded. """ chdir_app('file', 'session') self.application = TornadoApplication() self.session_handler_config = firenado.conf.session['handlers'][ firenado.conf.session['type']] self.session_handler_config = firenado.conf.session['handlers'][ firenado.conf.session['type']] self.session_handler_class = get_class_from_config( self.session_handler_config)
def setUp(self): """ Application configuration file will be read and components will be loaded. """ chdir_app('tornadoweb') self.application = TornadoApplication()
def test_root_url_slash_none(self): """ Test if the root path with a slash in the front will be returned without it was set on the app configuration. """ chdir_app("root_url_slash_none", "conf") self.assertEqual(None, firenado.conf.app['url_root_path'])
def test_session_name_default(self): """ Checks if the session name is default, FIRENADOSESSID """ chdir_app("file", "session") self.assertEqual(firenado.conf.session['enabled'], True) self.assertEqual(firenado.conf.session['name'], "FIRENADOSESSID")
def test_load(self): chdir_app('tornadoweb') launcher = TornadoLauncher() launcher.load() self.assertTrue(isinstance(launcher.application, TornadoApplication))
def test_root_url(self): """ Test if the root path was set on the app configuration. """ chdir_app("root_url", "conf") self.assertEqual("a_root_url", firenado.conf.app['url_root_path'])
def test_static_path(self): """ If static url prefix is defined on the app configuration. """ chdir_app("yml", "conf") self.assertEqual("yml_static_url_prefix", firenado.conf.app['static_url_prefix'])
def test_multi_app_false(self): """ Checks if the application isn't multi app """ chdir_app("tornadoweb") self.assertFalse(firenado.conf.app['multi'])
def test_app_pythonpath(self): """ Checks if the pythonpath is set on the application config file. """ chdir_app("file", "session") self.assertEqual(firenado.conf.app['pythonpath'], "..")
def test_multi_app_false(self): """ Checks if the application isn't multi app """ chdir_app("tornadoweb") self.assertFalse(firenado.conf.is_multi_app)
def test_session_name_custom(self): """ Checks if the session name will be defined as in the config file """ chdir_app("redis", "session") self.assertEqual(firenado.conf.session['enabled'], True) self.assertEqual(firenado.conf.session['name'], "REDISSESSID")
def test_multi_app_true(self): """ Checks if the application is multi app """ chdir_app("multiapp") self.assertTrue(firenado.conf.is_multi_app)
def test_session_type_redis(self): """ Checks if the session is enabled and the type is redis """ chdir_app("redis", "session") self.assertEqual(firenado.conf.session['enabled'], True) self.assertEqual(firenado.conf.session['type'], "redis")
def setUp(self): """ Application configuration file will be read and components will be loaded. """ chdir_app('redis', 'session')
def test_session_type_file(self): """ Checks if the session is enabled and the type is file """ chdir_app("file", "session") self.assertEqual(firenado.conf.session['enabled'], True) self.assertEqual(firenado.conf.session['type'], "file")
def test_settings_empty(self): """ If no app settings is defined an empty dict is set. """ chdir_app("yml", "conf") self.assertDictEqual({}, firenado.conf.app['settings'])
def test_multi_app_true(self): """ Checks if the application is multi app """ chdir_app("multiapp") self.assertTrue(firenado.conf.app['multi'])
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import (absolute_import, division, print_function, with_statement) import unittest import firenado.conf from firenado.config import get_class_from_config from tests import chdir_app from firenado.tornadoweb import TornadoApplication chdir_app('file', 'session') class StaticMapsTestCase(unittest.TestCase): """ Case that tests an Firenado application after being loaded from its configuration file. """ def setUp(self): """ Application configuration file will be read and components will be loaded. """ chdir_app('file', 'session') self.application = TornadoApplication() self.session_handler_config = firenado.conf.session['handlers'][ firenado.conf.session['type']] self.session_handler_config = firenado.conf.session['handlers'][
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import (absolute_import, division, print_function, with_statement) import unittest import firenado.conf from firenado.config import get_class_from_config from tests import chdir_app from firenado.tornadoweb import TornadoApplication chdir_app('file', 'session') class StaticMapsTestCase(unittest.TestCase): """ Case that tests an Firenado application after being loaded from its configuration file. """ def setUp(self): """ Application configuration file will be read and components will be loaded. """ chdir_app('file', 'session') self.application = TornadoApplication() self.session_handler_config = firenado.conf.session[ 'handlers'][firenado.conf.session['type']]