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

Side by Side Diff: third_party/boto/tests/unit/sts/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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved 2 # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
3 # 3 #
4 # Permission is hereby granted, free of charge, to any person obtaining a 4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the 5 # copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including 6 # "Software"), to deal in the Software without restriction, including
7 # without limitation the rights to use, copy, modify, merge, publish, dis- 7 # without limitation the rights to use, copy, modify, merge, publish, dis-
8 # tribute, sublicense, and/or sell copies of the Software, and to permit 8 # tribute, sublicense, and/or sell copies of the Software, and to permit
9 # persons to whom the Software is furnished to do so, subject to the fol- 9 # persons to whom the Software is furnished to do so, subject to the fol-
10 # lowing conditions: 10 # lowing conditions:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 'RoleSessionName': 'mysession'}, 74 'RoleSessionName': 'mysession'},
75 ignore_params_values=['Timestamp', 'AWSAccessKeyId', 75 ignore_params_values=['Timestamp', 'AWSAccessKeyId',
76 'SignatureMethod', 'SignatureVersion', 76 'SignatureMethod', 'SignatureVersion',
77 'Version']) 77 'Version'])
78 self.assertEqual(response.credentials.access_key, 'accesskey') 78 self.assertEqual(response.credentials.access_key, 'accesskey')
79 self.assertEqual(response.credentials.secret_key, 'secretkey') 79 self.assertEqual(response.credentials.secret_key, 'secretkey')
80 self.assertEqual(response.credentials.session_token, 'session_token') 80 self.assertEqual(response.credentials.session_token, 'session_token')
81 self.assertEqual(response.user.arn, 'arn:role') 81 self.assertEqual(response.user.arn, 'arn:role')
82 self.assertEqual(response.user.assume_role_id, 'roleid:myrolesession') 82 self.assertEqual(response.user.assume_role_id, 'roleid:myrolesession')
83 83
84 def test_assume_role_with_mfa(self):
85 self.set_http_response(status_code=200)
86 response = self.service_connection.assume_role(
87 'arn:role',
88 'mysession',
89 mfa_serial_number='GAHT12345678',
90 mfa_token='abc123'
91 )
92 self.assert_request_parameters(
93 {'Action': 'AssumeRole',
94 'RoleArn': 'arn:role',
95 'RoleSessionName': 'mysession',
96 'SerialNumber': 'GAHT12345678',
97 'TokenCode': 'abc123'},
98 ignore_params_values=['Timestamp', 'AWSAccessKeyId',
99 'SignatureMethod', 'SignatureVersion',
100 'Version'])
101 self.assertEqual(response.credentials.access_key, 'accesskey')
102 self.assertEqual(response.credentials.secret_key, 'secretkey')
103 self.assertEqual(response.credentials.session_token, 'session_token')
104 self.assertEqual(response.user.arn, 'arn:role')
105 self.assertEqual(response.user.assume_role_id, 'roleid:myrolesession')
106
84 107
85 class TestSTSWebIdentityConnection(AWSMockServiceTestCase): 108 class TestSTSWebIdentityConnection(AWSMockServiceTestCase):
86 connection_class = STSConnection 109 connection_class = STSConnection
87 110
88 def setUp(self): 111 def setUp(self):
89 super(TestSTSWebIdentityConnection, self).setUp() 112 super(TestSTSWebIdentityConnection, self).setUp()
90 113
91 def default_body(self): 114 def default_body(self):
92 return """ 115 return """
93 <AssumeRoleWithWebIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06- 15/"> 116 <AssumeRoleWithWebIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06- 15/">
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 ]) 247 ])
225 self.assertEqual(response.credentials.access_key, 'accesskey') 248 self.assertEqual(response.credentials.access_key, 'accesskey')
226 self.assertEqual(response.credentials.secret_key, 'secretkey') 249 self.assertEqual(response.credentials.secret_key, 'secretkey')
227 self.assertEqual(response.credentials.session_token, 'session_token') 250 self.assertEqual(response.credentials.session_token, 'session_token')
228 self.assertEqual(response.user.arn, 'arn:role') 251 self.assertEqual(response.user.arn, 'arn:role')
229 self.assertEqual(response.user.assume_role_id, 'roleid:myrolesession') 252 self.assertEqual(response.user.assume_role_id, 'roleid:myrolesession')
230 253
231 254
232 if __name__ == '__main__': 255 if __name__ == '__main__':
233 unittest.main() 256 unittest.main()
OLDNEW
« no previous file with comments | « third_party/boto/tests/unit/sqs/test_connection.py ('k') | third_party/boto/tests/unit/swf/test_layer2_base.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698