From bbee30c35e5eb438567e693f6df00644ad3bc4fb Mon Sep 17 00:00:00 2001 From: David Gouldin Date: Sat, 12 May 2012 15:20:14 -0700 Subject: Continuing to refactor oauth1 to use Request objects internally. --- tests/oauth1/rfc5849/test_parameters.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tests/oauth1/rfc5849/test_parameters.py') diff --git a/tests/oauth1/rfc5849/test_parameters.py b/tests/oauth1/rfc5849/test_parameters.py index 9765cab..4388123 100644 --- a/tests/oauth1/rfc5849/test_parameters.py +++ b/tests/oauth1/rfc5849/test_parameters.py @@ -7,6 +7,10 @@ from ...unittest import TestCase class ParameterTests(TestCase): + data_params = [ + (u'data_param_foo', u'foo'), + (u'data_param_1', u'1'), + ] auth_only_params = [ (u'oauth_consumer_key', u"9djdj82h48djs9d2"), (u'oauth_token', u"kkk9d7dh3k39sjv7"), @@ -15,9 +19,7 @@ class ParameterTests(TestCase): (u'oauth_nonce', u"7d8f3e4a"), (u'oauth_signature', u"bYT5CMsGcbgUdFHObYMEfcx6bsw=") ] - auth_and_data = list(auth_only_params) - auth_and_data.append((u'data_param_foo', u'foo')) - auth_and_data.append((u'data_param_1', u'1')) + auth_and_data = auth_only_params + data_params realm = u'testrealm' norealm_authorization_header = u' '.join(( u'OAuth', @@ -72,11 +74,11 @@ class ParameterTests(TestCase): {u'Authorization': self.withrealm_authorization_header}) def test_prepare_form_encoded_body(self): - request = Request(u'http://www.google.com/') + request = Request(u'http://www.google.com/', body=self.data_params) request.oauth_params = self.auth_only_params - form_encoded_body = 'data_param_foo=foo&data_param_1=1&oauth_consumer_key=9djdj82h48djs9d2&oauth_token=kkk9d7dh3k39sjv7&oauth_signature_method=HMAC-SHA1&oauth_timestamp=137131201&oauth_nonce=7d8f3e4a&oauth_signature=bYT5CMsGcbgUdFHObYMEfcx6bsw%3D' + form_encoded_body = u'data_param_foo=foo&data_param_1=1&oauth_consumer_key=9djdj82h48djs9d2&oauth_token=kkk9d7dh3k39sjv7&oauth_signature_method=HMAC-SHA1&oauth_timestamp=137131201&oauth_nonce=7d8f3e4a&oauth_signature=bYT5CMsGcbgUdFHObYMEfcx6bsw%3D' self.assertEqual( - urlencode(prepare_form_encoded_body(self.auth_and_data, existing_body)), + urlencode(prepare_form_encoded_body(request).body), form_encoded_body) def test_prepare_request_uri_query(self): -- cgit v1.2.1