def test_templatetag_get_root_sections(self):
        TestSection.load_bulk(BASE_DATA)
        self._patch_get_extending_model()
        # Test basic version of template tag.
        template = Template("""{%load sections%}
        <ul>{% get_root_sections as root_sections %}
        {{root_sections|pprint}}
        {%for nav in root_sections%}<li>{{nav.title}}</li>{%endfor%}
        </ul>
        """)
        context = Context({})
        result = template.render(context)
        # Test extended version of template tag.
        for root in TestSection.get_root_nodes():
            self.assertTrue(root.title in result)
        template = Template("""{%load sections%}
        <ul>{% get_root_sections with subsection as root_sections %}
        {{root_sections|pprint}}
        {%for nav in root_sections%}
            <li{%if nav.is_active%} class="active"{%endif%}>{{nav.title}}</li>
        {%endfor%}
        </ul>
        """)
        context = Context({'subsection': TestSection.objects.get(slug='231')})
        result = template.render(context)
        for root in TestSection.get_root_nodes():
            self.assertTrue(root.title in result)
        self.assertTrue('<li class="active">2</li>' in result)
Test that the get_root_sections template tag works as expected.
dataset/ETHPy150Open mazelife/django-scaffold/scaffold/tests.py/SectionTest.test_templatetag_get_root_sections