From 6c028477de31985da093395b3cf83adc6a704d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aitor=20Mag=C3=A1n?= Date: Mon, 28 Jul 2014 10:02:16 +0200 Subject: [PATCH] Remove unnecessary methods --- ckanext/privatedatasets/plugin.py | 26 +------------- ckanext/privatedatasets/tests/test_plugin.py | 36 -------------------- 2 files changed, 1 insertion(+), 61 deletions(-) diff --git a/ckanext/privatedatasets/plugin.py b/ckanext/privatedatasets/plugin.py index 86a66fe..a833a94 100644 --- a/ckanext/privatedatasets/plugin.py +++ b/ckanext/privatedatasets/plugin.py @@ -16,7 +16,7 @@ class PrivateDatasets(p.SingletonPlugin, tk.DefaultDatasetForm): p.implements(p.IConfigurer) p.implements(p.IRoutes, inherit=True) p.implements(p.IActions) - p.implements(p.IPackageController) + p.implements(p.IPackageController, inherit=True) p.implements(p.ITemplateHelpers) ###################################################################### @@ -134,24 +134,6 @@ class PrivateDatasets(p.SingletonPlugin, tk.DefaultDatasetForm): return pkg_dict - def before_view(self, pkg_dict): - return pkg_dict - - def before_search(self, search_params): - return search_params - - def create(self, pkg_dict): - return pkg_dict - - def edit(self, pkg_dict): - return pkg_dict - - def read(self, pkg_dict): - return pkg_dict - - def delete(self, pkg_dict): - return pkg_dict - def after_create(self, context, pkg_dict): session = context['session'] update_cache = False @@ -220,12 +202,6 @@ class PrivateDatasets(p.SingletonPlugin, tk.DefaultDatasetForm): return pkg_dict - def after_search(self, search_results, search_params): - return search_results - - def after_delete(self, context, pkg_dict): - return pkg_dict - ###################################################################### ######################### ITEMPLATESHELPER ########################### ###################################################################### diff --git a/ckanext/privatedatasets/tests/test_plugin.py b/ckanext/privatedatasets/tests/test_plugin.py index c7cf10b..003d6ea 100644 --- a/ckanext/privatedatasets/tests/test_plugin.py +++ b/ckanext/privatedatasets/tests/test_plugin.py @@ -140,22 +140,6 @@ class PluginTest(unittest.TestCase): ############################## PACKAGE ############################### ###################################################################### - @parameterized.expand([ - ('True'), - ('False') - ]) - def test_packagecontroller_after_delete(self, private): - pkg_dict = {'test': 'a', 'private': private, 'allowed_users': ['a', 'b', 'c']} - expected_pkg_dict = pkg_dict.copy() - result = self.privateDatasets.after_delete({}, pkg_dict) # Call the function - self.assertEquals(expected_pkg_dict, result) # Check the result - - def test_packagecontroller_after_search(self): - search_res = {'test': 'a', 'private': 'a', 'allowed_users': ['a', 'b', 'c']} - expected_search_res = search_res.copy() - result = getattr(self.privateDatasets, 'after_search')(search_res, {}) # Call the function - self.assertEquals(expected_search_res, result) # Check the result - @parameterized.expand([ (True, 1, 1, False, True), (True, 1, 2, False, True), @@ -197,26 +181,6 @@ class PluginTest(unittest.TestCase): else: self.assertFalse(field in result) - @parameterized.expand([ - ('before_search',), - ('before_view',), - ('create',), - ('edit',), - ('read',), - ('delete',), - ('before_search', 'False'), - ('before_view', 'False'), - ('create', 'False'), - ('edit', 'False'), - ('read', 'False'), - ('delete', 'False') - ]) - def test_before_and_CRUD(self, function, private='True'): - pkg_dict = {'test': 'a', 'private': private, 'allowed_users': ['a', 'b', 'c']} - expected_pkg_dict = pkg_dict.copy() - result = getattr(self.privateDatasets, function)(pkg_dict) # Call the function - self.assertEquals(expected_pkg_dict, result) # Check the result - @parameterized.expand([ ('public', None, 'public'), ('public', 'False', 'private'),