Readd auth_allow_anonymous_access to package_show. Add tests to check that "package_show" and "resource_show" have the decorator "auth_allow_anonymous_access"

This commit is contained in:
Aitor Magán 2014-07-01 14:41:52 +02:00
parent bd7630a372
commit 3144e8de18
2 changed files with 5 additions and 0 deletions

View File

@ -11,6 +11,7 @@ from ckan.common import _, request
########################### AUTH FUNCTIONS ########################### ########################### AUTH FUNCTIONS ###########################
###################################################################### ######################################################################
@tk.auth_allow_anonymous_access
def package_show(context, data_dict): def package_show(context, data_dict):
user = context.get('user') user = context.get('user')
user_obj = context.get('auth_user_obj') user_obj = context.get('auth_user_obj')

View File

@ -44,6 +44,10 @@ class PluginTest(unittest.TestCase):
self.assertTrue(plugin.p.IRoutes.implemented_by(plugin.PrivateDatasets)) self.assertTrue(plugin.p.IRoutes.implemented_by(plugin.PrivateDatasets))
self.assertTrue(plugin.p.IActions.implemented_by(plugin.PrivateDatasets)) self.assertTrue(plugin.p.IActions.implemented_by(plugin.PrivateDatasets))
def test_decordators(self):
self.assertEquals(True, getattr(plugin.package_show, 'auth_allow_anonymous_access', False))
self.assertEquals(True, getattr(plugin.resource_show, 'auth_allow_anonymous_access', False))
@parameterized.expand([ @parameterized.expand([
# Anonymous user (public) # Anonymous user (public)
(None, None, None, False, 'active', None, None, None, None, None, True), (None, None, None, False, 'active', None, None, None, None, None, True),