Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: third_party/boto/tests/unit/mws/test_connection.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/boto/tests/unit/mws/test_connection.py
===================================================================
--- third_party/boto/tests/unit/mws/test_connection.py (revision 33376)
+++ third_party/boto/tests/unit/mws/test_connection.py (working copy)
@@ -21,7 +21,8 @@
# IN THE SOFTWARE.
#
from boto.mws.connection import MWSConnection, api_call_map, destructure_object
-from boto.mws.response import ResponseElement
+from boto.mws.response import (ResponseElement, GetFeedSubmissionListResult,
+ ResponseFactory)
from tests.unit import AWSMockServiceTestCase
@@ -51,13 +52,16 @@
def test_destructure_object(self):
# Test that parsing of user input to Amazon input works.
- response = ResponseElement(name='Prefix')
+ response = ResponseElement()
response.C = 'four'
response.D = 'five'
inputs = [
('A', 'B'), ['B', 'A'], set(['C']),
False, 'String', {'A': 'one', 'B': 'two'},
response,
+ {'A': 'one', 'B': 'two',
+ 'C': [{'D': 'four', 'E': 'five'},
+ {'F': 'six', 'G': 'seven'}]},
]
outputs = [
{'Prefix.1': 'A', 'Prefix.2': 'B'},
@@ -66,10 +70,16 @@
{'Prefix': 'false'}, {'Prefix': 'String'},
{'Prefix.A': 'one', 'Prefix.B': 'two'},
{'Prefix.C': 'four', 'Prefix.D': 'five'},
+ {'Prefix.A': 'one', 'Prefix.B': 'two',
+ 'Prefix.C.member.1.D': 'four',
+ 'Prefix.C.member.1.E': 'five',
+ 'Prefix.C.member.2.F': 'six',
+ 'Prefix.C.member.2.G': 'seven'}
]
for user, amazon in zip(inputs, outputs):
result = {}
- destructure_object(user, result, prefix='Prefix')
+ members = user is inputs[-1]
+ destructure_object(user, result, prefix='Prefix', members=members)
self.assertEqual(result, amazon)
def test_built_api_call_map(self):
@@ -94,6 +104,31 @@
func = self.service_connection.method_for('NotHereNorThere')
self.assertEqual(func, None)
+ def test_response_factory(self):
+ connection = self.service_connection
+ body = self.default_body()
+ action = 'GetFeedSubmissionList'
+ parser = connection._response_factory(action, connection=connection)
+ response = connection._parse_response(parser, 'text/xml', body)
+ self.assertEqual(response._action, action)
+ self.assertEqual(response.__class__.__name__, action + 'Response')
+ self.assertEqual(response._result.__class__,
+ GetFeedSubmissionListResult)
+
+ class MyResult(GetFeedSubmissionListResult):
+ _hello = '_world'
+
+ scope = {'GetFeedSubmissionListResult': MyResult}
+ connection._setup_factories([scope])
+
+ parser = connection._response_factory(action, connection=connection)
+ response = connection._parse_response(parser, 'text/xml', body)
+ self.assertEqual(response._action, action)
+ self.assertEqual(response.__class__.__name__, action + 'Response')
+ self.assertEqual(response._result.__class__, MyResult)
+ self.assertEqual(response._result._hello, '_world')
+ self.assertEqual(response._result.HasNext, 'true')
+
def test_get_service_status(self):
with self.assertRaises(AttributeError) as err:
self.service_connection.get_service_status()
« no previous file with comments | « third_party/boto/tests/unit/iam/test_connection.py ('k') | third_party/boto/tests/unit/mws/test_response.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698