Skip to content

Commit

Permalink
[#2930] Api Tests allow sysadmin when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Oct 5, 2012
1 parent 0edd52d commit d99e4e5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ckan/tests/functional/api/base.py
Expand Up @@ -377,6 +377,8 @@ def init_extra_environ(cls, user_name):
# user logged in.
cls.user = model.User.by_name(user_name)
cls.extra_environ={'Authorization' : str(cls.user.apikey)}
cls.adminuser = model.User.by_name('testsysadmin')
cls.admin_extra_environ={'Authorization' : str(cls.adminuser.apikey)}

def post_json(self, offset, data, status=None, extra_environ=None):
''' Posts data in the body in application/json format, used by
Expand Down Expand Up @@ -424,3 +426,8 @@ def http_request(self, offset, data,
self.app._set_headers({}, environ)
req = TestRequest(offset, environ, expect_errors=False)
return self.app.do_request(req, status=status)

def set_env(self, extra_environ):
''' used to reset env when admin has been forced etc '''
environ = self.app._make_environ()
environ.update(extra_environ)

0 comments on commit d99e4e5

Please sign in to comment.