Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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')
Exemplo n.º 3
0
 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))
Exemplo n.º 4
0
 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))
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
 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)
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
    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
Exemplo n.º 10
0
 def test_multi_app_true(self):
     """ Checks if the application is multi app
     """
     chdir_app("multiapp")
     self.assertTrue(firenado.conf.app['multi'])
Exemplo n.º 11
0
 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")
Exemplo n.º 12
0
 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")
Exemplo n.º 13
0
 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")
Exemplo n.º 14
0
 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")
Exemplo n.º 15
0
 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'])
Exemplo n.º 16
0
# 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'][
Exemplo n.º 17
0
 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'])
Exemplo n.º 18
0
 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')
Exemplo n.º 19
0
 def setUp(self):
     """ Application configuration file will be read and components will be
     loaded.
     """
     chdir_app('tornadoweb')
     self.application = TornadoApplication()
Exemplo n.º 20
0
 def test_multi_app_false(self):
     """ Checks if the application isn't multi app
     """
     chdir_app("tornadoweb")
     self.assertFalse(firenado.conf.app['multi'])
Exemplo n.º 21
0
 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'])
Exemplo n.º 22
0
 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')
Exemplo n.º 23
0
 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'], "..")
Exemplo n.º 24
0
 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'])
Exemplo n.º 25
0
 def setUp(self):
     """ Application configuration file will be read and components will be
     loaded.
     """
     chdir_app('redis', 'session')
Exemplo n.º 26
0
 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'])