def setUpTestData(cls): Template.objects.bulk_create([ Template( name="Template 1", type=TEMPLATE_TYPE_CONFIGURATION, template="Template 1", ), Template( name="Template 2", type=TEMPLATE_TYPE_CONFIGURATION, template="Template 2", ), Template( name="Template 3", type=TEMPLATE_TYPE_CONFIGURATION, template="Template 3", ), ]) cls.form_data = { "name": "Routing Policy 4", "type": TEMPLATE_TYPE_EMAIL, "template": "Template 4", "comments": "", "tags": "", }
class TemplateTest(TestCase): def setUp(self): super().setUp() self.template = Template(name="Test", template="{{ test }}") def test_render(self): self.assertEqual(self.template.render({"test": "test"}), "test")
def setUpTestData(cls): Template.objects.bulk_create([ Template( name="Template 1", type=TEMPLATE_TYPE_CONFIGURATION, template="Template 1", ), Template( name="Template 2", type=TEMPLATE_TYPE_CONFIGURATION, template="Template 2", ), Template(name="Template 3", type=TEMPLATE_TYPE_EMAIL, template="Template 3"), ])
def setUp(self): super().setUp() self.template = Template(name="Test", template="{{ test }}")