Remove unnecessary methods

This commit is contained in:
Aitor Magán 2014-07-28 10:02:16 +02:00
parent 2e68c9b225
commit 6c028477de
2 changed files with 1 additions and 61 deletions

View File

@ -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 ###########################
######################################################################

View File

@ -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'),