예제 #1
0
 def test_checksum_added_only_if_not_exists(self):
     request_dict = {
         'headers': {
             'x-amz-content-sha256': 'pre-exists',
         },
         'body': six.BytesIO(b'hello world'),
     }
     handlers.add_glacier_checksums(request_dict)
     self.assertEqual(request_dict['headers']['x-amz-content-sha256'],
                      'pre-exists')
예제 #2
0
 def test_checksum_added_only_if_not_exists(self):
     request_dict = {
         'headers': {
             'x-amz-content-sha256': 'pre-exists',
         },
         'body': six.BytesIO(b'hello world'),
     }
     handlers.add_glacier_checksums(request_dict)
     self.assertEqual(request_dict['headers']['x-amz-content-sha256'],
                      'pre-exists')
예제 #3
0
 def test_glacier_checksums_support_raw_bytes(self):
     request_dict = {"headers": {}, "body": b"hello world"}
     handlers.add_glacier_checksums(request_dict)
     self.assertEqual(
         request_dict["headers"]["x-amz-content-sha256"],
         "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9",
     )
     self.assertEqual(
         request_dict["headers"]["x-amz-sha256-tree-hash"],
         "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9",
     )
예제 #4
0
 def test_glacier_checksums_support_raw_bytes(self):
     request_dict = {
         'headers': {},
         'body': b'hello world',
     }
     handlers.add_glacier_checksums(request_dict)
     self.assertEqual(
         request_dict['headers']['x-amz-content-sha256'],
         'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9')
     self.assertEqual(
         request_dict['headers']['x-amz-sha256-tree-hash'],
         'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9')
예제 #5
0
 def test_glacier_checksums_support_raw_bytes(self):
     request_dict = {
         'headers': {},
         'body': b'hello world',
     }
     handlers.add_glacier_checksums(request_dict)
     self.assertEqual(
         request_dict['headers']['x-amz-content-sha256'],
         'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9')
     self.assertEqual(
         request_dict['headers']['x-amz-sha256-tree-hash'],
         'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9')
예제 #6
0
 def test_glacier_checksums_added(self):
     request_dict = {"headers": {}, "body": six.BytesIO(b"hello world")}
     handlers.add_glacier_checksums(request_dict)
     self.assertIn("x-amz-content-sha256", request_dict["headers"])
     self.assertIn("x-amz-sha256-tree-hash", request_dict["headers"])
     self.assertEqual(
         request_dict["headers"]["x-amz-content-sha256"],
         "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9",
     )
     self.assertEqual(
         request_dict["headers"]["x-amz-sha256-tree-hash"],
         "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9",
     )
     # And verify that the body can still be read.
     self.assertEqual(request_dict["body"].read(), b"hello world")
예제 #7
0
 def test_glacier_checksums_added(self):
     request_dict = {
         'headers': {},
         'body': six.BytesIO(b'hello world'),
     }
     handlers.add_glacier_checksums(request_dict)
     self.assertIn('x-amz-content-sha256', request_dict['headers'])
     self.assertIn('x-amz-sha256-tree-hash', request_dict['headers'])
     self.assertEqual(
         request_dict['headers']['x-amz-content-sha256'],
         'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9')
     self.assertEqual(
         request_dict['headers']['x-amz-sha256-tree-hash'],
         'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9')
     # And verify that the body can still be read.
     self.assertEqual(request_dict['body'].read(), b'hello world')
예제 #8
0
 def test_glacier_checksums_added(self):
     request_dict = {
         'headers': {},
         'body': six.BytesIO(b'hello world'),
     }
     handlers.add_glacier_checksums(request_dict)
     self.assertIn('x-amz-content-sha256', request_dict['headers'])
     self.assertIn('x-amz-sha256-tree-hash', request_dict['headers'])
     self.assertEqual(
         request_dict['headers']['x-amz-content-sha256'],
         'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9')
     self.assertEqual(
         request_dict['headers']['x-amz-sha256-tree-hash'],
         'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9')
     # And verify that the body can still be read.
     self.assertEqual(request_dict['body'].read(), b'hello world')
예제 #9
0
 def test_checksum_added_only_if_not_exists(self):
     request_dict = {"headers": {"x-amz-content-sha256": "pre-exists"}, "body": six.BytesIO(b"hello world")}
     handlers.add_glacier_checksums(request_dict)
     self.assertEqual(request_dict["headers"]["x-amz-content-sha256"], "pre-exists")