'Test for issue 521
Build the following tree:
A
|-B
|-C
\-D (not in nav)'

def test_not_in_navigation_num_queries(self):

    a = create_page('A', 'nav_playground.html', 'en', published=True, in_navigation=True, reverse_id='a')
    b = create_page('B', 'nav_playground.html', 'en', parent=a, published=True, in_navigation=True)
    c = create_page('C', 'nav_playground.html', 'en', parent=b, published=True, in_navigation=True)
    create_page('D', 'nav_playground.html', 'en', parent=self.reload(b), published=True, in_navigation=False)
    with LanguageOverride('en'):
        context = self.get_context(a.get_absolute_url())
        with self.assertNumQueries(6):
            '\n                                                                The    queries    should    be:\n                                                                                get    all    public    pages\n                                                                                get    all    draft    pages    for    public    pages\n                                                                                get    all    page    permissions\n                                                                                get    all    titles\n                                                                                get    the    menu    cache    key\n                                                                                set    the    menu    cache    key\n                                                                '
            tpl = Template("{%    load    menu_tags    %}{%    show_menu_below_id    'a'    0    100    100    100    %}")
            tpl.render(context)
        nodes = context['children']
        self.assertEqual(len(nodes), 1, nodes)
        node = nodes[0]
        self.assertEqual(node.id, b.publisher_public.id)
        children = node.children
        self.assertEqual(len(children), 1, repr(children))
        child = children[0]
        self.assertEqual(child.id, c.publisher_public.id)
