mirror of
https://github.com/jazzband/django-constance.git
synced 2026-03-16 22:40:24 +00:00
added a test for the failing missing keys
This commit is contained in:
parent
482d8ff78b
commit
1d10ab1b5a
1 changed files with 27 additions and 0 deletions
|
|
@ -76,6 +76,9 @@ class TestRedis(TestCase, TestStorage):
|
|||
def setUp(self):
|
||||
self.old_backend = settings.BACKEND
|
||||
settings.BACKEND = 'constance.backends.redisd.RedisBackend'
|
||||
del sys.modules['constance']
|
||||
from constance import config
|
||||
config._backend._rd.clear()
|
||||
|
||||
def tearDown(self):
|
||||
del sys.modules['constance']
|
||||
|
|
@ -85,6 +88,30 @@ class TestRedis(TestCase, TestStorage):
|
|||
import constance
|
||||
constance.config = Config()
|
||||
|
||||
def testMissingValues(self):
|
||||
from constance import config
|
||||
|
||||
# set some values and leave out others
|
||||
config.LONG_VALUE = 654321L
|
||||
config.BOOL_VALUE = False
|
||||
config.UNICODE_VALUE = 'Québec'.decode('utf-8')
|
||||
config.DECIMAL_VALUE = Decimal('1.2')
|
||||
config.DATETIME_VALUE = datetime(1977, 10, 2)
|
||||
config.DATE_VALUE = date(2001, 12, 20)
|
||||
config.TIME_VALUE = time(1, 59, 0)
|
||||
|
||||
self.assertEquals(config.INT_VALUE, 1) # this should be the default value
|
||||
self.assertEquals(config.LONG_VALUE, 654321L)
|
||||
self.assertEquals(config.BOOL_VALUE, False)
|
||||
self.assertEquals(config.STRING_VALUE, 'Hello world') # this should be the default value
|
||||
self.assertEquals(config.UNICODE_VALUE, 'Québec'.decode('utf-8'))
|
||||
self.assertEquals(config.DECIMAL_VALUE, Decimal('1.2'))
|
||||
self.assertEquals(config.DATETIME_VALUE, datetime(1977, 10, 2))
|
||||
self.assertEquals(config.FLOAT_VALUE, 3.1415926536) # this should be the default value
|
||||
self.assertEquals(config.DATE_VALUE, date(2001, 12, 20))
|
||||
self.assertEquals(config.TIME_VALUE, time(1, 59, 0))
|
||||
|
||||
|
||||
class TestDatabase(TestCase, TestStorage):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue