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

Side by Side Diff: third_party/boto/tests/unit/glacier/test_layer2.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 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # Copyright (c) 2012 Thomas Parslow http://almostobsolete.net/ 2 # Copyright (c) 2012 Thomas Parslow http://almostobsolete.net/
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 15 matching lines...) Expand all
26 from mock import call, Mock, patch, sentinel 26 from mock import call, Mock, patch, sentinel
27 27
28 from boto.glacier.layer1 import Layer1 28 from boto.glacier.layer1 import Layer1
29 from boto.glacier.layer2 import Layer2 29 from boto.glacier.layer2 import Layer2
30 import boto.glacier.vault 30 import boto.glacier.vault
31 from boto.glacier.vault import Vault 31 from boto.glacier.vault import Vault
32 from boto.glacier.vault import Job 32 from boto.glacier.vault import Job
33 33
34 from StringIO import StringIO 34 from StringIO import StringIO
35 35
36 from datetime import datetime 36 from datetime import datetime, tzinfo, timedelta
37 37
38 # Some fixture data from the Glacier docs 38 # Some fixture data from the Glacier docs
39 FIXTURE_VAULT = { 39 FIXTURE_VAULT = {
40 "CreationDate" : "2012-02-20T17:01:45.198Z", 40 "CreationDate" : "2012-02-20T17:01:45.198Z",
41 "LastInventoryDate" : "2012-03-20T17:03:43.221Z", 41 "LastInventoryDate" : "2012-03-20T17:03:43.221Z",
42 "NumberOfArchives" : 192, 42 "NumberOfArchives" : 192,
43 "SizeInBytes" : 78088912, 43 "SizeInBytes" : 78088912,
44 "VaultARN" : "arn:aws:glacier:us-east-1:012345678901:vaults/examplevault", 44 "VaultARN" : "arn:aws:glacier:us-east-1:012345678901:vaults/examplevault",
45 "VaultName" : "examplevault" 45 "VaultName" : "examplevault"
46 } 46 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 "examplevault", self.vault.DefaultPartSize, "stuff") 204 "examplevault", self.vault.DefaultPartSize, "stuff")
205 self.assertEqual(writer.vault, self.vault) 205 self.assertEqual(writer.vault, self.vault)
206 self.assertEqual(writer.upload_id, "UPLOADID") 206 self.assertEqual(writer.upload_id, "UPLOADID")
207 207
208 def test_delete_vault(self): 208 def test_delete_vault(self):
209 self.vault.delete_archive("archive") 209 self.vault.delete_archive("archive")
210 self.mock_layer1.delete_archive.assert_called_with("examplevault", 210 self.mock_layer1.delete_archive.assert_called_with("examplevault",
211 "archive") 211 "archive")
212 212
213 def test_initiate_job(self): 213 def test_initiate_job(self):
214 class UTC(tzinfo):
215 """UTC"""
216
217 def utcoffset(self, dt):
218 return timedelta(0)
219
220 def tzname(self, dt):
221 return "Z"
222
223 def dst(self, dt):
224 return timedelta(0)
225
214 self.mock_layer1.initiate_job.return_value = {'JobId': 'job-id'} 226 self.mock_layer1.initiate_job.return_value = {'JobId': 'job-id'}
215 self.vault.retrieve_inventory(start_date=datetime(2014, 01, 01), 227 self.vault.retrieve_inventory(start_date=datetime(2014, 01, 01, tzinfo=U TC()),
216 end_date=datetime(2014, 01, 02), 228 end_date=datetime(2014, 01, 02, tzinfo=UTC ()),
217 limit=100) 229 limit=100)
218 self.mock_layer1.initiate_job.assert_called_with( 230 self.mock_layer1.initiate_job.assert_called_with(
219 'examplevault', { 231 'examplevault', {
220 'Type': 'inventory-retrieval', 232 'Type': 'inventory-retrieval',
221 'InventoryRetrievalParameters': { 233 'InventoryRetrievalParameters': {
222 'StartDate': '2014-01-01T00:00:00', 234 'StartDate': '2014-01-01T00:00:00Z',
223 'EndDate': '2014-01-02T00:00:00', 235 'EndDate': '2014-01-02T00:00:00Z',
224 'Limit': 100 236 'Limit': 100
225 } 237 }
226 }) 238 })
227 239
228 def test_get_job(self): 240 def test_get_job(self):
229 self.mock_layer1.describe_job.return_value = FIXTURE_ARCHIVE_JOB 241 self.mock_layer1.describe_job.return_value = FIXTURE_ARCHIVE_JOB
230 job = self.vault.get_job( 242 job = self.vault.get_job(
231 "NkbByEejwEggmBz2fTHgJrg0XBoDfjP4q6iu87-TjhqG6eGoOY9Z8i1_AUyUsuhPA" 243 "NkbByEejwEggmBz2fTHgJrg0XBoDfjP4q6iu87-TjhqG6eGoOY9Z8i1_AUyUsuhPA"
232 "dTqLHy8pTl5nfCFJmDl2yEZONi5L26Omw12vcs01MNGntHEQL8MBfGlqrEXAMPLEA" 244 "dTqLHy8pTl5nfCFJmDl2yEZONi5L26Omw12vcs01MNGntHEQL8MBfGlqrEXAMPLEA"
233 "rchiveId") 245 "rchiveId")
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 AssertionError, Vault._range_string_to_part_index, '0-5', 4) 332 AssertionError, Vault._range_string_to_part_index, '0-5', 4)
321 333
322 def test_range_start_mismatch(self): 334 def test_range_start_mismatch(self):
323 self.assertRaises( 335 self.assertRaises(
324 AssertionError, Vault._range_string_to_part_index, '1-3', 4) 336 AssertionError, Vault._range_string_to_part_index, '1-3', 4)
325 337
326 def test_range_end_mismatch(self): 338 def test_range_end_mismatch(self):
327 # End mismatch is OK, since the last part might be short 339 # End mismatch is OK, since the last part might be short
328 self.assertEquals( 340 self.assertEquals(
329 Vault._range_string_to_part_index('0-2', 4), 0) 341 Vault._range_string_to_part_index('0-2', 4), 0)
OLDNEW
« no previous file with comments | « third_party/boto/tests/unit/glacier/test_concurrent.py ('k') | third_party/boto/tests/unit/iam/test_connection.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698