Merge branch 'develop' of github.com:conwetlab/ckanext-privatedatasets into develop
This commit is contained in:
commit
304ee2a62e
|
@ -5,7 +5,7 @@ This CKAN extension allows a user to create private datasets that only certain u
|
|||
|
||||
Installation
|
||||
------------
|
||||
Install this extension in your CKAN is instance is as easy as intall any other CKAN extension.
|
||||
Install this extension in your CKAN instance is as easy as intall any other CKAN extension.
|
||||
|
||||
* Download the source from this GitHub repo.
|
||||
* Activate your virtual environment (generally by running `. /usr/lib/ckan/default/bin/activate`)
|
||||
|
|
|
@ -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