mirror of
https://github.com/jazzband/django-constance.git
synced 2026-03-16 22:40:24 +00:00
Added basic tests
This commit is contained in:
parent
ec9490656c
commit
b307e06f86
2 changed files with 34 additions and 0 deletions
1
constance/tests/__init__.py
Normal file
1
constance/tests/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from constance.tests.test_config import *
|
||||
33
constance/tests/test_config.py
Normal file
33
constance/tests/test_config.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
from django.test import TestCase
|
||||
from django.conf import settings
|
||||
|
||||
from constance import config
|
||||
|
||||
|
||||
|
||||
class TestStorage(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.old_config = getattr(settings, 'CONSTANCE_CONFIG', None)
|
||||
settings.CONSTANCE_CONFIG = {
|
||||
'INT_VALUE': (1, 'some int'),
|
||||
'BOOL_VALUE': (True, 'true or false'),
|
||||
'STRING_VALUE': ('Hello world', 'greetings'),
|
||||
}
|
||||
|
||||
def test_store(self):
|
||||
# read defaults
|
||||
self.assertEquals(config.INT_VALUE, 1)
|
||||
self.assertEquals(config.BOOL_VALUE, True)
|
||||
self.assertEquals(config.STRING_VALUE, 'Hello world')
|
||||
|
||||
config.INT_VALUE = 100
|
||||
config.BOOL_VALUE = False
|
||||
|
||||
self.assertEquals(config.INT_VALUE, 100)
|
||||
self.assertEquals(config.BOOL_VALUE, False)
|
||||
self.assertEquals(config.STRING_VALUE, 'Hello world')
|
||||
|
||||
def tearDown(self):
|
||||
if self.old_config:
|
||||
settings.CONSTANCE_CONFIG = self.old_config
|
||||
Loading…
Reference in a new issue