def djng_all_rmi(): """ Returns a dictionary of all methods for all Views available for this project, marked with the ``@allow_remote_invocation`` decorator. The return string can be used directly to initialize the AngularJS provider, such as ``djangoRMIProvider.configure({% djng_rmi_configs %});`` """ return mark_safe(json.dumps(get_all_remote_methods()))
def djng_all_rmi(): """ Returns a dictionary of all methods for all Views available for this project, marked with the ``@allow_remote_invocation`` decorator. The return string can be used directly to initialize the AngularJS provider, such as ``djangoRMIProvider.configure({% djng_rmi_configs %});`` """ return mark_safe(json.dumps(get_all_remote_methods()))
def test_get_all_remote_methods(self): remote_methods = get_all_remote_methods() self.assertDictEqual( remote_methods, { 'urlresolvertags': { 'blah': { u'url': '/url_resolvers/', u'headers': { u'DjNg-Remote-Method': 'blah' }, u'method': 'auto' } }, 'submethods': { 'sub': { 'app': { 'foo': { u'url': '/sub_methods/sub/app/', u'headers': { u'DjNg-Remote-Method': 'foo' }, u'method': 'auto' }, 'bar': { u'url': '/sub_methods/sub/app/', u'headers': { u'DjNg-Remote-Method': 'bar' }, u'method': 'auto' } } } } })
def test_get_all_remote_methods(self): remote_methods = get_all_remote_methods() expected = { 'urlresolvertags': {'blah': {u'url': '/url_resolvers/', u'headers': {u'DjNg-Remote-Method': 'blah'}, u'method': 'auto'}}, 'submethods': { 'app': {'foo': {u'url': '/sub_methods/sub/app/', u'headers': {u'DjNg-Remote-Method': 'foo'}, u'method': 'auto'}, 'bar': {u'url': '/sub_methods/sub/app/', u'headers': {u'DjNg-Remote-Method': 'bar'}, u'method': 'auto'}}, }, } self.assertDictEqual(remote_methods, expected)