[ckan-changes] commit/ckan: dread: [controller]: #1340 Fix exception when editing non-existent group.

Bitbucket commits-noreply at bitbucket.org
Wed Sep 14 09:08:45 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/33856d3ce84e/
changeset:   33856d3ce84e
user:        dread
date:        2011-09-14 11:04:33
summary:     [controller]: #1340 Fix exception when editing non-existent group.
affected #:  2 files (362 bytes)

--- a/ckan/controllers/group.py	Wed Sep 14 00:38:04 2011 +0100
+++ b/ckan/controllers/group.py	Wed Sep 14 10:04:33 2011 +0100
@@ -141,6 +141,8 @@
 
             data = data or old_data
 
+        except NotFound:
+            abort(404, _('Group not found'))
         except NotAuthorized:
             abort(401, _('Unauthorized to read group %s') % '')
 


--- a/ckan/tests/functional/test_group.py	Wed Sep 14 00:38:04 2011 +0100
+++ b/ckan/tests/functional/test_group.py	Wed Sep 14 10:04:33 2011 +0100
@@ -42,8 +42,6 @@
     def teardown_class(self):
         model.repo.rebuild_db()
 
-    # TODO: remove test (?)
-    # why: very fragile and overly detailed checking of main menu:w
     def test_mainmenu(self):
         offset = url_for(controller='home', action='index')
         res = self.app.get(offset)
@@ -84,6 +82,11 @@
             res = res.click(pkg.title)
             assert '%s - Datasets' % pkg.title in res
 
+    def test_read_non_existent(self):
+        name = u'group_does_not_exist'
+        offset = url_for(controller='group', action='read', id=name)
+        res = self.app.get(offset, status=404)
+
     def test_read_plugin_hook(self):
         plugin = MockGroupControllerPlugin()
         plugins.load(plugin)
@@ -201,6 +204,11 @@
         assert plugin.calls['edit'] == 1, plugin.calls
         plugins.unload(plugin)
 
+    def test_edit_non_existent(self):
+        name = u'group_does_not_exist'
+        offset = url_for(controller='group', action='edit', id=name)
+        res = self.app.get(offset, status=404)
+
 class TestNew(FunctionalTestCase):
     groupname = u'david'

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list