Exemple #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.assertEqual(firenado.conf.app['port'], 8887)
Exemple #2
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.assertEqual(firenado.conf.app['port'], 8887)
Exemple #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.assertEqual("yml", _file.get_file_extension(
             firenado.conf.APP_CONFIG_FILE))
Exemple #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.assertEqual("yml", fs.get_file_extension(
             firenado.conf.APP_CONFIG_FILE))
Exemple #5
0
 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")
Exemple #6
0
 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")
Exemple #7
0
 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)
Exemple #8
0
 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)
Exemple #9
0
 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")
Exemple #10
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'])
Exemple #11
0
 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")
Exemple #12
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)
Exemple #13
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)
Exemple #14
0
 def setUp(self):
     """ Application configuration file will be read and components will be
     loaded.
     """
     chdir_app('tornadoweb')
     self.application = TornadoApplication()
Exemple #15
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.assertEqual(None,  firenado.conf.app['url_root_path'])
Exemple #16
0
 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")
Exemple #17
0
 def test_load(self):
     chdir_app('tornadoweb')
     launcher = TornadoLauncher()
     launcher.load()
     self.assertTrue(isinstance(launcher.application, TornadoApplication))
Exemple #18
0
 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'])
Exemple #19
0
 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'])
Exemple #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'])
Exemple #21
0
 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'], "..")
Exemple #22
0
 def test_multi_app_false(self):
     """ Checks if the application isn't multi app
     """
     chdir_app("tornadoweb")
     self.assertFalse(firenado.conf.is_multi_app)
Exemple #23
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.assertEqual(firenado.conf.session['enabled'], True)
     self.assertEqual(firenado.conf.session['name'], "REDISSESSID")
Exemple #24
0
 def test_multi_app_true(self):
     """ Checks if the application is multi app
     """
     chdir_app("multiapp")
     self.assertTrue(firenado.conf.is_multi_app)
Exemple #25
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.assertEqual(firenado.conf.session['enabled'], True)
     self.assertEqual(firenado.conf.session['name'], "REDISSESSID")
Exemple #26
0
 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")
Exemple #27
0
 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'], "..")
Exemple #28
0
 def setUp(self):
     """ Application configuration file will be read and components will be
     loaded.
     """
     chdir_app('tornadoweb')
     self.application = TornadoApplication()
Exemple #29
0
 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'])
Exemple #30
0
 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")
Exemple #31
0
 def setUp(self):
     """ Application configuration file will be read and components will be
     loaded.
     """
     chdir_app('redis', 'session')
Exemple #32
0
 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'])
Exemple #33
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.assertEqual(None,  firenado.conf.app['url_root_path'])
Exemple #34
0
 def setUp(self):
     """ Application configuration file will be read and components will be
     loaded.
     """
     chdir_app('redis', 'session')
Exemple #35
0
 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")
Exemple #36
0
 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")
Exemple #37
0
 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")
Exemple #38
0
 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'])
Exemple #39
0
 def test_multi_app_true(self):
     """ Checks if the application is multi app
     """
     chdir_app("multiapp")
     self.assertTrue(firenado.conf.app['multi'])
Exemple #40
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 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'][
Exemple #41
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 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']]
Exemple #42
0
 def test_load(self):
     chdir_app('tornadoweb')
     launcher = TornadoLauncher()
     launcher.load()
     self.assertTrue(isinstance(launcher.application, TornadoApplication))