#246 Make the test for declaractively specified templates more robust.

This commit is contained in:
Bradley Ayers 2015-05-10 08:43:30 +10:00
parent 679eb76daa
commit 2bb4a0c54e
1 changed files with 12 additions and 9 deletions

View File

@ -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()