Skip to content

Commit

Permalink
new_tests.helpers.call_auth now work for any auth type (update, creat…
Browse files Browse the repository at this point in the history
…e, ...)
  • Loading branch information
vitorbaptista authored and amercader committed Jun 19, 2014
1 parent 987c090 commit e8a34ce
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ckan/new_tests/helpers.py
Expand Up @@ -19,6 +19,7 @@
'''
import ckan.model as model
import ckan.logic as logic
import ckan.new_authz as new_authz


def reset_db():
Expand Down Expand Up @@ -106,13 +107,9 @@ def call_auth(auth_name, context, **kwargs):
:rtype: dict
'''
import ckan.logic.auth.update

assert 'user' in context, ('Test methods must put a user name in the '
'context dict')
assert 'model' in context, ('Test methods must put a model in the '
'context dict')

# FIXME: Do we want to go through check_access() here?
auth_function = ckan.logic.auth.update.__getattribute__(auth_name)
return auth_function(context=context, data_dict=kwargs)
return new_authz.is_authorized(auth_name, context, data_dict=kwargs)

0 comments on commit e8a34ce

Please sign in to comment.