Merge pull request #28 from conwetlab/develop
Compatibility with CKAN 2.3 (develop -> master)
This commit is contained in:
commit
18623c7d1e
|
@ -108,11 +108,18 @@ class PrivateDatasets(p.SingletonPlugin, tk.DefaultDatasetForm):
|
|||
######################################################################
|
||||
|
||||
def get_auth_functions(self):
|
||||
return {'package_show': auth.package_show,
|
||||
'package_update': auth.package_update,
|
||||
'resource_show': auth.resource_show,
|
||||
constants.PACKAGE_ACQUIRED: auth.package_acquired,
|
||||
constants.ACQUISITIONS_LIST: auth.acquisitions_list}
|
||||
auth_functions = {'package_show': auth.package_show,
|
||||
'package_update': auth.package_update,
|
||||
# 'resource_show': auth.resource_show,
|
||||
constants.PACKAGE_ACQUIRED: auth.package_acquired,
|
||||
constants.ACQUISITIONS_LIST: auth.acquisitions_list}
|
||||
|
||||
# resource_show is not required in CKAN 2.3 because it delegates to
|
||||
# package_show
|
||||
if not tk.check_ckan_version(min_version='2.3'):
|
||||
auth_functions['resource_show'] = auth.resource_show
|
||||
|
||||
return auth_functions
|
||||
|
||||
######################################################################
|
||||
############################ ICONFIGURER #############################
|
||||
|
|
|
@ -62,13 +62,19 @@ class PluginTest(unittest.TestCase):
|
|||
@parameterized.expand([
|
||||
('package_show', plugin.auth.package_show),
|
||||
('package_update', plugin.auth.package_update),
|
||||
('package_show', plugin.auth.package_show),
|
||||
('resource_show', plugin.auth.resource_show),
|
||||
('resource_show', plugin.auth.resource_show, True, False),
|
||||
('package_acquired', plugin.auth.package_acquired),
|
||||
('acquisitions_list', plugin.auth.acquisitions_list)
|
||||
])
|
||||
def test_auth_function(self, function_name, expected_function):
|
||||
def test_auth_function(self, function_name, expected_function, is_ckan_23=False, expected=True):
|
||||
plugin.tk.check_ckan_version = MagicMock(return_value=is_ckan_23)
|
||||
auth_functions = self.privateDatasets.get_auth_functions()
|
||||
self.assertEquals(auth_functions[function_name], expected_function)
|
||||
|
||||
if expected:
|
||||
self.assertEquals(auth_functions[function_name], expected_function)
|
||||
else:
|
||||
self.assertNotIn(function_name, auth_functions)
|
||||
|
||||
def test_update_config(self):
|
||||
# Call the method
|
||||
|
|
Loading…
Reference in New Issue