From 2bb4a0c54e0aab36b8928a2505699bf26a12c27d Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Sun, 10 May 2015 08:43:30 +1000 Subject: [PATCH] #246 Make the test for declaractively specified templates more robust. --- tests/test_core.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index 9a33bbb..09c5d69 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -531,15 +531,6 @@ def test_field_names_with_prefix(): def test_should_support_a_template_to_be_specified(): - class MetaDeclarationSpecifiedTemplateTable(tables.Table): - name = tables.Column() - - class Meta: - template = "dummy.html" - - table = MetaDeclarationSpecifiedTemplateTable([]) - assert table.template == "dummy.html" - class ConstructorSpecifiedTemplateTable(tables.Table): name = tables.Column() @@ -560,6 +551,18 @@ def test_should_support_a_template_to_be_specified(): assert table.template == "django_tables2/table.html" +def test_template_in_meta_class_declaration_should_be_honored(): + class MetaDeclarationSpecifiedTemplateTable(tables.Table): + name = tables.Column() + + class Meta: + template = "dummy.html" + + table = MetaDeclarationSpecifiedTemplateTable([]) + assert table.template == "dummy.html" + assert table.as_html() == "dummy template contents\n" + + def test_should_support_rendering_multiple_times(): class MultiRenderTable(tables.Table): name = tables.Column()