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.assertEquals(firenado.conf.app['port'], 8887)
def test_session_type_redis(self): """ Checks if test component was loaded correctly by the application __init__ method. """ chdir_app('redis', 'session') self.assertEquals(firenado.conf.session['enabled'], True) self.assertEquals(firenado.conf.session['type'], 'redis')
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.assertEquals('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.assertEquals( "yml", _file.get_file_extension(firenado.conf.APP_CONFIG_FILE))
def test_app_stack(self): """ Application config is provided. Test if the app config file was loaded. """ chdir_app("yml", "conf") self.assertEquals(firenado.conf.stack[0], firenado.conf.LIB_CONFIG_FILE) self.assertEquals(firenado.conf.stack[1], firenado.conf.APP_CONFIG_FILE)
def test_app_stack(self): """ Application config is provided. Test if the app config file was loaded. """ chdir_app('yml', 'conf') self.assertEquals(firenado.conf.stack[0], firenado.conf.LIB_CONFIG_FILE) self.assertEquals(firenado.conf.stack[1], firenado.conf.APP_CONFIG_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'][ 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 test_session_type_file(self): """ Checks if test component was loaded correctly by the application __init__ method. """ chdir_app('file', 'session') application = TornadoApplication() session_handler_config = firenado.conf.session[ 'handlers'][firenado.conf.session['type']] session_handler_class = get_class_from_config(session_handler_config) app_session_handler_class = \ application.session_engine.session_handler.__class__ self.assertEquals(app_session_handler_class, session_handler_class) print(str(session_handler_class)) print(application.session_engine.session_handler.__class__) sess_handler_path = application.session_engine.session_handler.path sess_handler_path
def test_multi_app_true(self): """ Checks if the application is multi app """ chdir_app("multiapp") self.assertTrue(firenado.conf.app['multi'])
def test_session_name_custom(self): """ Checks if the session name will be defined as in the config file """ chdir_app("redis", "session") self.assertEquals(firenado.conf.session['enabled'], True) self.assertEquals(firenado.conf.session['name'], "REDISSESSID")
def test_session_type_redis(self): """ Checks if the session is enabled and the type is redis """ chdir_app("redis", "session") self.assertEquals(firenado.conf.session['enabled'], True) self.assertEquals(firenado.conf.session['type'], "redis")
def test_session_name_default(self): """ Checks if the session name is default, FIRENADOSESSID """ chdir_app("file", "session") self.assertEquals(firenado.conf.session['enabled'], True) self.assertEquals(firenado.conf.session['name'], "FIRENADOSESSID")
def test_session_type_file(self): """ Checks if the session is enabled and the type is file """ chdir_app("file", "session") self.assertEquals(firenado.conf.session['enabled'], True) self.assertEquals(firenado.conf.session['type'], "file")
def test_static_path(self): """ If static url prefix is defined on the app configuration. """ chdir_app("yml", "conf") self.assertEquals("yml_static_url_prefix", firenado.conf.app['static_url_prefix'])
# 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 firenado.test 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'][
def test_static_path(self): """ If static path is defined than app configuration should get it. """ chdir_app('yml', 'conf') self.assertEquals('yml_static_path', firenado.conf.app['static_path'])
def test_session_type_file(self): """ Checks if the session is enabled and the type is file """ chdir_app('file', 'session') self.assertEquals(firenado.conf.session['enabled'], True) self.assertEquals(firenado.conf.session['type'], 'file')
def setUp(self): """ Application configuration file will be read and components will be loaded. """ chdir_app('tornadoweb') self.application = TornadoApplication()
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_root_url(self): """ Test if the root path was set on the app configuration. """ chdir_app("root_url", "conf") self.assertEquals("a_root_url", firenado.conf.app['url_root_path'])
def test_session_type_redis(self): """ Checks if the session is enabled and the type is redis """ chdir_app('redis', 'session') self.assertEquals(firenado.conf.session['enabled'], True) self.assertEquals(firenado.conf.session['type'], 'redis')
def test_app_pythonpath(self): """ Checks if the pythonpath is set on the application config file. """ chdir_app("file", "session") self.assertEquals(firenado.conf.app['pythonpath'], "..")
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.assertEquals(None, firenado.conf.app['url_root_path'])
def setUp(self): """ Application configuration file will be read and components will be loaded. """ chdir_app('redis', 'session')
def test_static_path(self): """ If static path is defined than app configuration should get it. """ chdir_app('yml', 'conf') self.assertEquals('yml_static_path', firenado.conf.app['static_path'])