# 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

    activate('en')
    result = template_render_tag('sitetree', 'sitetree_tree from "i18tree"', template_context())

    assert '/url_default/' in result
    assert 'My title' in result

    activate('ru')
    result = template_render_tag('sitetree', 'sitetree_tree from "i18tree"', template_context())

    assert '/url_ru/' in result
    assert 'Заголовок' in result

    activate('pt-br')
    result = template_render_tag('sitetree', 'sitetree_tree from "i18tree"', template_context())

    assert '/url_pt-br/' in result
    assert 'Meu Título' in result

    activate('zh-hans')
    result = template_render_tag('sitetree', 'sitetree_tree from "i18tree"', template_context())

    assert '/url_zh-hans/' in result
    assert '我蒂特' in result

    deactivate_all()


def test_restricted(user_create, template_render_tag, template_context, common_tree):
    context = template_context()

# 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


    activate('en')
    result = template_render_tag('sitetree', 'sitetree_tree from "i18tree"', template_context())

    assert '/url_default/' in result
    assert 'My title' in result

    activate('ru')
    result = template_render_tag('sitetree', 'sitetree_tree from "i18tree"', template_context())

    assert '/url_ru/' in result
    assert 'Заголовок' in result

    activate('pt-br')
    result = template_render_tag('sitetree', 'sitetree_tree from "i18tree"', template_context())

    assert '/url_pt-br/' in result
    assert 'Meu Título' in result

    activate('zh-hans')
    result = template_render_tag('sitetree', 'sitetree_tree from "i18tree"', template_context())

    assert '/url_zh-hans/' in result
    assert '我蒂特' in result

    deactivate_all()


def test_restricted(user_create, template_render_tag, template_context, common_tree):
    context = template_context()

    result = template_render_tag('sitetree', 'sitetree_tree from "mytree"', context)