Esempio 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.assertEqual(firenado.conf.app['port'], 8887)
Esempio n. 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)
Esempio 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.assertEqual("yml", _file.get_file_extension(
             firenado.conf.APP_CONFIG_FILE))
Esempio 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.assertEqual("yml", fs.get_file_extension(
             firenado.conf.APP_CONFIG_FILE))
Esempio n. 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")
Esempio n. 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")
Esempio n. 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)
Esempio n. 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)
Esempio n. 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")
Esempio n. 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'])
Esempio n. 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")
Esempio n. 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)
Esempio n. 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)
Esempio n. 14
0
 def setUp(self):
     """ Application configuration file will be read and components will be
     loaded.
     """
     chdir_app('tornadoweb')
     self.application = TornadoApplication()
Esempio n. 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'])
Esempio n. 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")
Esempio n. 17
0
 def test_load(self):
     chdir_app('tornadoweb')
     launcher = TornadoLauncher()
     launcher.load()
     self.assertTrue(isinstance(launcher.application, TornadoApplication))
Esempio n. 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'])
Esempio n. 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'])
Esempio 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'])
Esempio n. 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'], "..")
Esempio n. 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)
Esempio n. 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")
Esempio n. 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)
Esempio n. 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")
Esempio n. 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")
Esempio n. 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'], "..")
Esempio n. 28
0
 def setUp(self):
     """ Application configuration file will be read and components will be
     loaded.
     """
     chdir_app('tornadoweb')
     self.application = TornadoApplication()
Esempio n. 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'])
Esempio n. 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")
Esempio n. 31
0
 def setUp(self):
     """ Application configuration file will be read and components will be
     loaded.
     """
     chdir_app('redis', 'session')
Esempio n. 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'])
Esempio n. 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'])
Esempio n. 34
0
 def setUp(self):
     """ Application configuration file will be read and components will be
     loaded.
     """
     chdir_app('redis', 'session')
Esempio n. 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")
Esempio n. 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")
Esempio n. 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")
Esempio n. 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'])
Esempio n. 39
0
 def test_multi_app_true(self):
     """ Checks if the application is multi app
     """
     chdir_app("multiapp")
     self.assertTrue(firenado.conf.app['multi'])
Esempio n. 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'][
Esempio n. 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']]
Esempio n. 42
0
 def test_load(self):
     chdir_app('tornadoweb')
     launcher = TornadoLauncher()
     launcher.load()
     self.assertTrue(isinstance(launcher.application, TornadoApplication))