You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/03/06 13:35:15 UTC
[08/26] allura git commit: [#7832] ticket:731 Add support for DELETE
to test app
[#7832] ticket:731 Add support for DELETE to test app
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2fac9ece
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2fac9ece
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2fac9ece
Branch: refs/heads/ib/7830
Commit: 2fac9ece7929e1e88d08252097b1595a7fd4ce69
Parents: 0979146
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Feb 20 16:28:30 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Feb 27 22:40:52 2015 +0000
----------------------------------------------------------------------
AlluraTest/alluratest/controller.py | 11 +++++++----
AlluraTest/alluratest/validation.py | 7 +++++++
2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/2fac9ece/AlluraTest/alluratest/controller.py
----------------------------------------------------------------------
diff --git a/AlluraTest/alluratest/controller.py b/AlluraTest/alluratest/controller.py
index 4237624..4398a82 100644
--- a/AlluraTest/alluratest/controller.py
+++ b/AlluraTest/alluratest/controller.py
@@ -209,7 +209,7 @@ class TestRestApiBase(TestController):
return self._token_cache[username]
- def _api_getpost(self, method, path, wrap_args=None, user='test-admin', status=None, **params):
+ def _api_call(self, method, path, wrap_args=None, user='test-admin', status=None, **params):
'''
If you need to use one of the method kwargs as a URL parameter,
pass params={...} as a dict instead of **kwargs
@@ -224,7 +224,7 @@ class TestRestApiBase(TestController):
params['access_token'] = self.token(user).api_key
- fn = self.app.post if method == 'POST' else self.app.get
+ fn = getattr(self.app, method.lower())
response = fn(
str(path),
@@ -236,7 +236,10 @@ class TestRestApiBase(TestController):
return response
def api_get(self, path, wrap_args=None, user='test-admin', status=None, **params):
- return self._api_getpost('GET', path, wrap_args, user, status, **params)
+ return self._api_call('GET', path, wrap_args, user, status, **params)
def api_post(self, path, wrap_args=None, user='test-admin', status=None, **params):
- return self._api_getpost('POST', path, wrap_args, user, status, **params)
+ return self._api_call('POST', path, wrap_args, user, status, **params)
+
+ def api_delete(self, path, wrap_args=None, user='test-admin', status=None, **params):
+ return self._api_call('DELETE', path, wrap_args, user, status, **params)
http://git-wip-us.apache.org/repos/asf/allura/blob/2fac9ece/AlluraTest/alluratest/validation.py
----------------------------------------------------------------------
diff --git a/AlluraTest/alluratest/validation.py b/AlluraTest/alluratest/validation.py
index 1bf6b22..97691df 100644
--- a/AlluraTest/alluratest/validation.py
+++ b/AlluraTest/alluratest/validation.py
@@ -315,3 +315,10 @@ class ValidatingTestApp(PostParamCheckingTestApp):
if not self.validate_skip and not val_params['validate_skip']:
self._validate(resp, 'post', val_params)
return resp
+
+ def delete(self, *args, **kw):
+ val_params, kw = self._get_validation_params(kw)
+ resp = super(ValidatingTestApp, self).delete(*args, **kw)
+ if not self.validate_skip and not val_params['validate_skip']:
+ self._validate(resp, 'delete', val_params)
+ return resp