[snowy: 3/8] Fix a problem with oauth-authenticated POST requests in the unit tests
- From: Sanford Armstrong <sharm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snowy: 3/8] Fix a problem with oauth-authenticated POST requests in the unit tests
- Date: Mon, 1 Mar 2010 23:16:31 +0000 (UTC)
commit 585bdcee2dae90d4022fd65673e75414c48647f9
Author: Leon Handreke <leon handreke gmail com>
Date: Wed Feb 17 17:09:38 2010 +0100
Fix a problem with oauth-authenticated POST requests in the unit tests
All the BadMethods unit tests now pass
api/tests.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/api/tests.py b/api/tests.py
index 4bcfdae..9fa7e0f 100644
--- a/api/tests.py
+++ b/api/tests.py
@@ -75,14 +75,15 @@ class OAuthRequester:
self.oa_atoken = oa_atoken
- def build_request(self, abs_uri, method):
+ def build_request(self, abs_uri, method, parameters={}):
url = 'http://' + self.SERVER_NAME + abs_uri
oaconsumer = oauth.OAuthConsumer(self.consumer.key,
self.consumer.secret)
request = oauth.OAuthRequest.from_consumer_and_token(oaconsumer,
token=self.oa_atoken,
http_url=url,
- http_method=method)
+ http_method=method,
+ parameters=parameters)
request.sign_request(self.signature_method, oaconsumer, self.oa_atoken)
return request
@@ -103,7 +104,8 @@ class OAuthRequester:
HTTP_AUTHORIZATION=auth)
def post(self, abs_uri, json):
- request = self.build_request(abs_uri, 'POST')
+ # Pass the json data to be appended to the http header - seems to work
+ request = self.build_request(abs_uri, 'POST', parameters={json : ''})
auth = self.build_auth_header(request)
return self.test_case.client.post(abs_uri, data=json,
content_type='application/json',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]