~phanatic/django-configglue/more-supported-releases

« back to all changes in this revision

Viewing changes to django_configglue/tests/test_settings.py

  • Committer: Ricardo Kirkner
  • Date: 2011-07-27 01:02:05 UTC
  • mfrom: (57.1.3 configglue-1.0-compatible)
  • Revision ID: ricardo.kirkner@canonical.com-20110727010205-03cj5bg5tlntja6w
Updated django-configglue to make it compatible with configglue 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2010 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
2
2
# GNU Lesser General Public License version 3 (see the file LICENSE).
3
3
 
4
4
import os.path
8
8
from django.conf import settings
9
9
from django.core.management import ManagementUtility
10
10
 
 
11
from mock import patch, Mock
 
12
 
11
13
from django_configglue.utils import SETTINGS_ENCODING
 
14
from django_configglue.schema import schemas
12
15
from django_configglue.tests.helpers import (
13
16
    ConfigGlueDjangoCommandTestCase,
14
17
    SchemaHelperTestCase,
112
115
class GeneratedSettingsTestCase(ConfigGlueDjangoCommandTestCase,
113
116
        SchemaHelperTestCase):
114
117
    def setUp(self):
115
 
        from django_configglue.schema import schemas
116
 
        from mock import patch, Mock
117
 
 
118
118
        self.expected_schema = schemas.get(
119
119
            django.get_version(), strict=True)()
120
120
 
129
129
        self.patch.stop()
130
130
        super(GeneratedSettingsTestCase, self).tearDown()
131
131
 
132
 
    def test_generated_schema(self):
 
132
    @patch('django_configglue.schema.logging.warn')
 
133
    def test_generated_schema(self, mock_warn):
133
134
        # import here so that the necessary modules can be mocked before
134
135
        # being required
135
136
        from django.conf import settings
136
137
        schema = settings.__CONFIGGLUE_PARSER__.schema
137
138
        self.assert_schemas_equal(schema, self.expected_schema)
138
139
 
 
140
        self.assertEqual(mock_warn.call_args_list,
 
141
            [(("No schema registered for version 'foo'",), {}),
 
142
             (("Dynamically creating schema for version 'foo'",), {})])
 
143
 
139
144
 
140
145
class ValidateCommandTestCase(ConfigGlueDjangoCommandTestCase):
141
146
    COMMAND = 'settings'