Skip to content
Snippets Groups Projects
Commit f84b8f37 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Add basic test that defaults are carried through

parent 16f0a189
No related branches found
No related tags found
No related merge requests found
# from django.test import TestCase
# Create your tests here.
import factory
from ..models import Category
class CategoryFactory(factory.DjangoModelFactory):
class Meta:
model = Category
name = factory.Faker('word')
help_text = factory.Faker('sentence')
from django.test import TestCase
from opentech.apply.categories.blocks import CategoryQuestionBlock
from .factories import CategoryFactory
class TestCategoryQuestionBlock(TestCase):
@classmethod
def setUp(self):
self.category = CategoryFactory()
self.block = CategoryQuestionBlock()
def test_field_and_help_default(self):
block = self.block.to_python({
'field_label': '',
'help_text': '',
'category': self.category.id,
'multi': False,
})
field = self.block.get_field(block)
self.assertEqual(self.category.name, field.label)
self.assertEqual(self.category.help_text, field.help_text)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment