# Path: staticgen/templatetags/staticgen_tags.py
# @register.simple_tag(takes_context=True)
# def routable_pageurl(context, page=1, page_kwarg='page'):
#     request = context['request']
# 
#     try:
#         match = resolve(request.path_info)
#     except Resolver404:  # pragma: no cover
#         pass
#     else:
#         if match.namespace:
#             namespace = '{0}:'.format(match.namespace)
#         else:
#             namespace = ''
# 
#         current_url = '{namespace}{url_name}'.format(
#             namespace=namespace, url_name=match.url_name)
# 
#         match.kwargs[page_kwarg] = page
#         return reverse(current_url, args=match.args, kwargs=match.kwargs)
# 
#     return ''


from django.core.urlresolvers import reverse
from django.test import TestCase, RequestFactory
from staticgen.templatetags.staticgen_tags import routable_pageurl
# -*- coding: utf-8 -*-

from __future__ import unicode_literals




class TestStaticgenRoutablePageTemplateTag(TestCase):

    def setUp(self):
        self.rf = RequestFactory()
        self.request = self.rf.get(reverse('post_list'))
        self.context = {'request': self.request}

    def test_routable_pageurl_templatetag(self):

# Path: staticgen/templatetags/staticgen_tags.py
# @register.simple_tag(takes_context=True)
# def routable_pageurl(context, page=1, page_kwarg='page'):
#     request = context['request']
# 
#     try:
#         match = resolve(request.path_info)
#     except Resolver404:  # pragma: no cover
#         pass
#     else:
#         if match.namespace:
#             namespace = '{0}:'.format(match.namespace)
#         else:
#             namespace = ''
# 
#         current_url = '{namespace}{url_name}'.format(
#             namespace=namespace, url_name=match.url_name)
# 
#         match.kwargs[page_kwarg] = page
#         return reverse(current_url, args=match.args, kwargs=match.kwargs)
# 
#     return ''


# Path: tests/test_templatetags.py
from django.core.urlresolvers import reverse
from django.test import TestCase, RequestFactory
from staticgen.templatetags.staticgen_tags import routable_pageurl

# -*- coding: utf-8 -*-

from __future__ import unicode_literals




class TestStaticgenRoutablePageTemplateTag(TestCase):

    def setUp(self):
        self.rf = RequestFactory()
        self.request = self.rf.get(reverse('post_list'))
        self.context = {'request': self.request}

    def test_routable_pageurl_templatetag(self):

        self.assertEqual(routable_pageurl(self.context, 2), '/posts/page/2/')