From 8db023aa9c0f2ebbffc86c93c0da6f8ddd8af1be Mon Sep 17 00:00:00 2001 From: James Saryerwinnie Date: Tue, 5 Aug 2014 17:34:46 -0700 Subject: [PATCH] Add unittest for #196 --- tests/unit/test_s3_operations.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/unit/test_s3_operations.py b/tests/unit/test_s3_operations.py index 85a804883a..d6a0352d74 100644 --- a/tests/unit/test_s3_operations.py +++ b/tests/unit/test_s3_operations.py @@ -58,6 +58,14 @@ 'Enabled0' 'GLACIER' '') +PUT_OBJECT_ACL = ( + '' + 'namemyid' + 'FULL_CONTROL' + 'namemyid' + '') + POLICY = ('{"Version": "2008-10-17","Statement": [{"Sid": "AddPerm",' '"Effect": "Allow","Principal": {"AWS": "*"},' @@ -323,3 +331,26 @@ def test_complete_multipart_upload(self): # Explicitly check that is not in the payload anywhere. self.assertNotIn('', xml_payload) self.assertNotIn('', xml_payload) + + def test_put_object_acl(self): + op = self.s3.get_operation('PutObjectAcl') + params = op.build_parameters( + bucket=self.bucket_name, key=self.key_name, + access_control_policy={ + "Owner": { + "DisplayName": "name", + "ID": "myid" + }, + "Grants": [ + { + "Grantee": { + "DisplayName": "name", + "Type": "CanonicalUser", + "ID": "myid" + }, + "Permission": "FULL_CONTROL" + } + ] + }) + xml_payload = params['payload'].getvalue() + self.assertEqual(xml_payload, PUT_OBJECT_ACL)