Skip to content

Commit

Permalink
Merge branch 'master' of github.com:okfn/ckan into add-shared-post-me…
Browse files Browse the repository at this point in the history
…thod-for-api-tests
  • Loading branch information
Sean Hammond committed Nov 28, 2012
2 parents 0449abe + 5301384 commit ec3fdd4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions ckan/model/activity.py
Expand Up @@ -150,6 +150,10 @@ def _group_activity_query(group_id, limit=15):
import ckan.model as model

group = model.Group.get(group_id)
if not group:
# Return a query with no results.
return model.Session.query(model.Activity).filter("0=1")

dataset_ids = [dataset.id for dataset in group.packages()]

q = model.Session.query(model.Activity)
Expand Down
18 changes: 10 additions & 8 deletions ckan/tests/mock_publisher_auth.py
@@ -1,21 +1,24 @@
from ckan.new_authz import is_authorized
from ckan.logic import NotAuthorized
import logging

log = logging.getLogger("mock_publisher_auth")


class MockPublisherAuth(object):
"""
MockPublisherAuth
"""

def __init__(self):
self.functions = {}
self._load()

def _load(self):
for auth_module_name in ['get', 'create', 'update','delete']:
for auth_module_name in ['get', 'create', 'update', 'delete']:
module_path = 'ckan.logic.auth.publisher.%s' % (auth_module_name,)
try:
module = __import__(module_path)
except ImportError,e:
except ImportError:
log.debug('No auth module for action "%s"' % auth_module_name)
continue

Expand All @@ -25,10 +28,9 @@ def _load(self):
for key, v in module.__dict__.items():
if not key.startswith('_'):
self.functions[key] = v


def check_access(self,action, context, data_dict):

def check_access(self, action, context, data_dict):
logic_authorization = self.functions[action](context, data_dict)
if not logic_authorization['success']:
msg = logic_authorization.get('msg','')
msg = logic_authorization.get('msg', '')
raise NotAuthorized(msg)
1 change: 0 additions & 1 deletion pip-requirements-test.txt
@@ -1,6 +1,5 @@
# These are packages that required when running ckan tests

nose
requests==0.6.4
-e git+https://github.com/okfn/ckanclient#egg=ckanclient

1 change: 1 addition & 0 deletions pip-requirements.txt
Expand Up @@ -27,3 +27,4 @@ routes==1.13
paste==1.7.5.1
Jinja2==2.6
fanstatic==0.12
requests==0.14

0 comments on commit ec3fdd4

Please sign in to comment.