Esempio n. 1
0
    def test_configglue_calls(self, MockSchemaConfigParser,
                              mock_update_settings):

        target = {}
        configglue(BaseDjangoSchema, [], target)

        MockSchemaConfigParser.assert_called_with(BaseDjangoSchema())
        MockSchemaConfigParser.return_value.read.assert_called_with([])
        mock_update_settings.assert_called_with(
            MockSchemaConfigParser.return_value, target)
    def test_configglue_calls(self, MockSchemaConfigParser,
        mock_update_settings):

        target = {}
        configglue(BaseDjangoSchema, [], target)

        MockSchemaConfigParser.assert_called_with(BaseDjangoSchema())
        MockSchemaConfigParser.return_value.read.assert_called_with([])
        mock_update_settings.assert_called_with(
            MockSchemaConfigParser.return_value, target)
Esempio n. 3
0
    def test_configglue(self):
        target = {}
        schema = schemas.get(django.get_version(), strict=False)
        configglue(schema, [], target)
        # target is consistent with django's settings module
        # except for a few keys
        exclude_keys = ['DATABASE_SUPPORTS_TRANSACTIONS', 'SETTINGS_MODULE']
        # CACHE_BACKEND has been removed from django 1.3 schema but is
        # added by django at runtime, so let's skip that too
        if schema.version >= '1.3':
            exclude_keys.append('CACHE_BACKEND')
        shared_key = lambda x: (not x.startswith('__') and x.upper() == x and x
                                not in exclude_keys)
        expected_keys = set(filter(shared_key, dir(settings)))
        target_keys = set(filter(shared_key, target.keys()))

        self.assertEqual(expected_keys, target_keys)
    def test_configglue(self):
        target = {}
        schema = schemas.get(django.get_version(), strict=False)
        configglue(schema, [], target)
        # target is consistent with django's settings module
        # except for a few keys
        exclude_keys = ['DATABASE_SUPPORTS_TRANSACTIONS', 'SETTINGS_MODULE']
        # CACHE_BACKEND has been removed from django 1.3 schema but is
        # added by django at runtime, so let's skip that too
        if schema.version >= '1.3':
            exclude_keys.append('CACHE_BACKEND')
        shared_key = lambda x: (not x.startswith('__') and x.upper() == x and
            x not in exclude_keys)
        expected_keys = set(filter(shared_key, dir(settings)))
        target_keys = set(filter(shared_key, target.keys()))

        self.assertEqual(expected_keys, target_keys)
Esempio n. 5
0
import os.path
from django_configglue.utils import configglue
from schema import FenchurchSchema

# get absolute path for config files
current_dir = os.path.dirname(os.path.abspath(__file__))
config_files = map(lambda x: os.path.join(current_dir, x),
        ['../cfg/main.cfg',
         '../../local_config/local.cfg',
         '../cfg/local.cfg'])

# make django aware of configglue-based configuration
configglue(FenchurchSchema, config_files, locals())
INSTALLED_APPS.append('django_jenkins')
Esempio n. 6
0
# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
# GNU Lesser General Public License version 3 (see the file LICENSE).

import django
from django_configglue.utils import configglue
from django_configglue.schema import schemas


DjangoSchema = schemas.get(django.get_version(), strict=False)

version = DjangoSchema.version
main_cfg = 'main.cfg'
if version >= '1.3':
    main_cfg = 'main-13.cfg'
elif version >= '1.2':
    main_cfg = 'main-12.cfg'

configglue(DjangoSchema, [main_cfg, 'test.cfg'], __name__)
Esempio n. 7
0
# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
# GNU Lesser General Public License version 3 (see the file LICENSE).

import django
from django_configglue.utils import configglue
from django_configglue.schema import schemas

DjangoSchema = schemas.get(django.get_version(), strict=False)

version = DjangoSchema.version
main_cfg = 'main.cfg'
if version >= '1.3':
    main_cfg = 'main-13.cfg'
elif version >= '1.2':
    main_cfg = 'main-12.cfg'

configglue(DjangoSchema, [main_cfg, 'test.cfg'], __name__)
Esempio n. 8
0
# This software is licensed under the GNU Affero General Public 
# License version 3 (AGPLv3), as published by the Free Software 
# Foundation, and may be copied, distributed, and modified under 
# those terms.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# file LICENSE for more details.
#
###################################################################

import os

from django_configglue.utils import configglue

from identityprovider.schema import schema


# get location of local cfg files
local_configs = os.environ.get('CONFIGGLUE_LOCAL_CONFIG',
	'local.cfg').split(':')

# get absolute path for config files
current_dir = os.path.dirname(os.path.abspath(__file__))
config_files = map(lambda x: os.path.join(current_dir, x),
                   ['config/main.cfg'] + local_configs)

# glue everything together
configglue(schema, config_files, __name__)