mirror of
https://github.com/jazzband/django-constance.git
synced 2026-03-16 22:40:24 +00:00
Added test of form field types
This commit is contained in:
parent
0e05de4f9b
commit
5d299f6222
1 changed files with 25 additions and 0 deletions
25
tests/test_form.py
Normal file
25
tests/test_form.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from constance.admin import ConstanceForm
|
||||
from django.forms import fields
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
class TestForm(TestCase):
|
||||
|
||||
def test_form_field_types(self):
|
||||
|
||||
f = ConstanceForm({})
|
||||
|
||||
self.assertIsInstance(f.fields['INT_VALUE'], fields.IntegerField)
|
||||
self.assertIsInstance(f.fields['LONG_VALUE'], fields.IntegerField)
|
||||
self.assertIsInstance(f.fields['BOOL_VALUE'], fields.BooleanField)
|
||||
self.assertIsInstance(f.fields['STRING_VALUE'], fields.CharField)
|
||||
self.assertIsInstance(f.fields['UNICODE_VALUE'], fields.CharField)
|
||||
self.assertIsInstance(f.fields['DECIMAL_VALUE'], fields.DecimalField)
|
||||
self.assertIsInstance(f.fields['DATETIME_VALUE'], fields.SplitDateTimeField)
|
||||
self.assertIsInstance(f.fields['FLOAT_VALUE'], fields.FloatField)
|
||||
self.assertIsInstance(f.fields['DATE_VALUE'], fields.DateField)
|
||||
self.assertIsInstance(f.fields['TIME_VALUE'], fields.TimeField)
|
||||
|
||||
# from CONSTANCE_ADDITIONAL_FIELDS
|
||||
self.assertIsInstance(f.fields['CHOICE_VALUE'], fields.ChoiceField)
|
||||
self.assertIsInstance(f.fields['EMAIL_VALUE'], fields.EmailField)
|
||||
Loading…
Reference in a new issue