# Path: sitetree/exceptions.py
# class SiteTreeError(Exception):
#     """Exception class for sitetree application."""
# 
# Path: sitetree/settings.py
# ALIAS_THIS_ANCESTOR_CHILDREN = 'this-ancestor-children'
# 
# ALIAS_THIS_CHILDREN = 'this-children'
# 
# ALIAS_THIS_PARENT_SIBLINGS = 'this-parent-siblings'
# 
# ALIAS_THIS_SIBLINGS = 'this-siblings'
# 
# ALIAS_TRUNK = 'trunk'


import pytest
from django.template.base import TemplateSyntaxError
from django.utils.translation import activate, deactivate_all
from sitetree.exceptions import SiteTreeError
from sitetree.settings import ALIAS_THIS_ANCESTOR_CHILDREN, ALIAS_THIS_CHILDREN, ALIAS_THIS_PARENT_SIBLINGS, \
    ALIAS_THIS_SIBLINGS, ALIAS_TRUNK
    from sitetree.toolbox import register_items_hook
    from sitetree.toolbox import register_i18n_trees
    from sitetree.models import TreeItem
    assert 'django.core.context_processors.request' in f'{e.value}'

    context = template_context(request='/unknown_url/')

    with pytest.raises(SiteTreeError) as e:
        template_render_tag('sitetree', f'sitetree_page_{realm} from "mytree"', context)

    assert 'Unable to resolve current sitetree item' in f'{e.value}'

    monkeypatch.setattr('sitetree.sitetreeapp.RAISE_ITEMS_ERRORS_ON_DEBUG', False)
    result = template_render_tag('sitetree', f'sitetree_page_{realm} from "mytree"', context)

    assert result == ''


def test_sitetree_page_title(settings, monkeypatch, template_render_tag, template_context, common_tree):
    check_page_attr_tag('title', 'Russia', settings, monkeypatch, template_render_tag, template_context)


def test_sitetree_page_hint(settings, monkeypatch, template_render_tag, template_context, common_tree):
    check_page_attr_tag('hint', 'The place', settings, monkeypatch, template_render_tag, template_context)


def test_sitetree_page_description(settings, monkeypatch, template_render_tag, template_context, common_tree):
    check_page_attr_tag(
        'description', 'Russian Federation', settings, monkeypatch, template_render_tag, template_context)


def test_sitetree_url(template_render_tag, template_context, common_tree):


# Path: sitetree/exceptions.py
# class SiteTreeError(Exception):
#     """Exception class for sitetree application."""
# 
# Path: sitetree/settings.py
# ALIAS_THIS_ANCESTOR_CHILDREN = 'this-ancestor-children'
# 
# ALIAS_THIS_CHILDREN = 'this-children'
# 
# ALIAS_THIS_PARENT_SIBLINGS = 'this-parent-siblings'
# 
# ALIAS_THIS_SIBLINGS = 'this-siblings'
# 
# ALIAS_TRUNK = 'trunk'


# Path: sitetree/tests/test_templatetags.py
import pytest
from django.template.base import TemplateSyntaxError
from django.utils.translation import activate, deactivate_all
from sitetree.exceptions import SiteTreeError
from sitetree.settings import ALIAS_THIS_ANCESTOR_CHILDREN, ALIAS_THIS_CHILDREN, ALIAS_THIS_PARENT_SIBLINGS, \
    ALIAS_THIS_SIBLINGS, ALIAS_TRUNK
    from sitetree.toolbox import register_items_hook
    from sitetree.toolbox import register_i18n_trees
    from sitetree.models import TreeItem

    assert 'django.core.context_processors.request' in f'{e.value}'

    context = template_context(request='/unknown_url/')

    with pytest.raises(SiteTreeError) as e:
        template_render_tag('sitetree', f'sitetree_page_{realm} from "mytree"', context)

    assert 'Unable to resolve current sitetree item' in f'{e.value}'

    monkeypatch.setattr('sitetree.sitetreeapp.RAISE_ITEMS_ERRORS_ON_DEBUG', False)
    result = template_render_tag('sitetree', f'sitetree_page_{realm} from "mytree"', context)

    assert result == ''


def test_sitetree_page_title(settings, monkeypatch, template_render_tag, template_context, common_tree):
    check_page_attr_tag('title', 'Russia', settings, monkeypatch, template_render_tag, template_context)


def test_sitetree_page_hint(settings, monkeypatch, template_render_tag, template_context, common_tree):
    check_page_attr_tag('hint', 'The place', settings, monkeypatch, template_render_tag, template_context)


def test_sitetree_page_description(settings, monkeypatch, template_render_tag, template_context, common_tree):
    check_page_attr_tag(
        'description', 'Russian Federation', settings, monkeypatch, template_render_tag, template_context)


def test_sitetree_url(template_render_tag, template_context, common_tree):


    with pytest.raises(TemplateSyntaxError):