예제 #1
0
파일: test_boxes.py 프로젝트: 3108as/ella
    def test_box_works_for_any_class(self):
        class TestClass(object):
            title = 'Heyoo'
        test_obj = TestClass()
        test_box = Box(test_obj, 'box_type', [])

        tools.assert_equals([
            'box/content_type/testclass/box_type.html',
            'box/content_type/testclass/box.html',
            'box/box_type.html',
            'box/box.html'
        ], test_box._get_template_list())

        template_loader.templates['box/content_type/testclass/box_type.html'] = '{{ object.title}}'
        tools.assert_equals('Heyoo', test_box.render(Context({})))
예제 #2
0
    def test_box_works_for_any_class(self):
        class TestClass(object):
            title = 'Heyoo'

        test_obj = TestClass()
        test_box = Box(test_obj, 'box_type', [])

        tools.assert_equals([
            'box/content_type/testclass/box_type.html',
            'box/content_type/testclass/box.html', 'box/box_type.html',
            'box/box.html'
        ], test_box._get_template_list())

        template_loader.templates[
            'box/content_type/testclass/box_type.html'] = '{{ object.title}}'
        tools.assert_equals('Heyoo', test_box.render(Context({})))
예제 #3
0
    def test_box_works_for_any_class(self):
        class TestClass(object):
            title = "Heyoo"

        test_obj = TestClass()
        test_box = Box(test_obj, "box_type", [])

        tools.assert_equals(
            [
                "box/content_type/testclass/box_type.html",
                "box/content_type/testclass/box.html",
                "box/box_type.html",
                "box/box.html",
            ],
            test_box._get_template_list(),
        )

        template_loader.templates["box/content_type/testclass/box_type.html"] = "{{ object.title}}"
        tools.assert_equals("Heyoo", test_box.render(Context({})))