# Path: djng/core/urlresolvers.py
# def get_all_remote_methods(resolver=None, ns_prefix=''):
#     """
#     Returns a dictionary to be used for calling ``djangoCall.configure()``, which itself extends the
#     Angular API to the client, offering him to call remote methods.
#     """
#     if not resolver:
#         resolver = get_resolver(get_urlconf())
#     result = {}
#     for name in resolver.reverse_dict.keys():
#         if not isinstance(name, str):
#             continue
#         try:
#             url = reverse(ns_prefix + name)
#             resmgr = resolve(url)
#             ViewClass = import_string('{0}.{1}'.format(resmgr.func.__module__, resmgr.func.__name__))
#             if isclass(ViewClass) and issubclass(ViewClass, JSONResponseMixin):
#                 result[name] = _get_remote_methods_for(ViewClass, url)
#         except (NoReverseMatch, ImproperlyConfigured):
#             pass
#     for namespace, ns_pattern in resolver.namespace_dict.items():
#         sub_res = get_all_remote_methods(ns_pattern[1], ns_prefix + namespace + ':')
#         if sub_res:
#             result[namespace] = sub_res
#     return result
# 
# def get_current_remote_methods(view):
#     if isinstance(view, JSONResponseMixin):
#         return _get_remote_methods_for(view, view.request.path_info)
# 
# Path: examples/server/tests/urls.py
# class RemoteMethodsView(JSONResponseMixin, View):
#     @allow_remote_invocation
#     def foo(self, in_data):
#         return {'foo': 'abc'}
# 
#     @allow_remote_invocation
#     def bar(self, in_data):
#         return {'bar': 'abc'}
# 
#     def get(self, request):
#         template = Template("{% load djng_tags %}{% load_djng_urls 'SELF' %}")
#         context = RequestContext(request, {})
#         return HttpResponse(template.render(context))


from django.test import override_settings, TestCase
from django.test.client import RequestFactory
from djng.core.urlresolvers import get_all_remote_methods, get_current_remote_methods
from .urls import RemoteMethodsView
# -*- coding: utf-8 -*-





TEST_URL_PATH = 'server.tests.urls'


@override_settings(ROOT_URLCONF=TEST_URL_PATH)
class TemplateRemoteMethods(TestCase):

    def setUp(self):
        self.factory = RequestFactory()

    def test_get_current_remote_methods(self):
        view = RemoteMethodsView()
        view.request = self.factory.get('/straight_methods/')
        remote_methods = get_current_remote_methods(view)

# Path: djng/core/urlresolvers.py
# def get_all_remote_methods(resolver=None, ns_prefix=''):
#     """
#     Returns a dictionary to be used for calling ``djangoCall.configure()``, which itself extends the
#     Angular API to the client, offering him to call remote methods.
#     """
#     if not resolver:
#         resolver = get_resolver(get_urlconf())
#     result = {}
#     for name in resolver.reverse_dict.keys():
#         if not isinstance(name, str):
#             continue
#         try:
#             url = reverse(ns_prefix + name)
#             resmgr = resolve(url)
#             ViewClass = import_string('{0}.{1}'.format(resmgr.func.__module__, resmgr.func.__name__))
#             if isclass(ViewClass) and issubclass(ViewClass, JSONResponseMixin):
#                 result[name] = _get_remote_methods_for(ViewClass, url)
#         except (NoReverseMatch, ImproperlyConfigured):
#             pass
#     for namespace, ns_pattern in resolver.namespace_dict.items():
#         sub_res = get_all_remote_methods(ns_pattern[1], ns_prefix + namespace + ':')
#         if sub_res:
#             result[namespace] = sub_res
#     return result
# 
# def get_current_remote_methods(view):
#     if isinstance(view, JSONResponseMixin):
#         return _get_remote_methods_for(view, view.request.path_info)
# 
# Path: examples/server/tests/urls.py
# class RemoteMethodsView(JSONResponseMixin, View):
#     @allow_remote_invocation
#     def foo(self, in_data):
#         return {'foo': 'abc'}
# 
#     @allow_remote_invocation
#     def bar(self, in_data):
#         return {'bar': 'abc'}
# 
#     def get(self, request):
#         template = Template("{% load djng_tags %}{% load_djng_urls 'SELF' %}")
#         context = RequestContext(request, {})
#         return HttpResponse(template.render(context))


# Path: examples/server/tests/test_urlresolvers.py
from django.test import override_settings, TestCase
from django.test.client import RequestFactory
from djng.core.urlresolvers import get_all_remote_methods, get_current_remote_methods
from .urls import RemoteMethodsView

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





TEST_URL_PATH = 'server.tests.urls'


@override_settings(ROOT_URLCONF=TEST_URL_PATH)
class TemplateRemoteMethods(TestCase):

    def setUp(self):
        self.factory = RequestFactory()

    def test_get_current_remote_methods(self):
        view = RemoteMethodsView()
        view.request = self.factory.get('/straight_methods/')
        remote_methods = get_current_remote_methods(view)

        expected = {