def test_access_control_policy_to_xml(self): grantee = acls.Grantee(id='8a6925ce4adf588a4f21c32aa379004fef', display_name='*****@*****.**') grant1 = acls.Grant(grantee, 'FULL_CONTROL') grantee = acls.Grantee(id='8a6925ce4adf588a4f21c32aa37900feed', display_name='*****@*****.**') grant2 = acls.Grant(grantee, 'READ') owner = acls.Owner(id='8a6925ce4adf588a4f21c32aa37900beef', display_name='*****@*****.**') acp = acls.AccessControlPolicy(owner=owner, access_control_list=[grant1, grant2]) xml_bytes = acp.to_xml() self.assertEquals(xml_bytes, payload.sample_access_control_policy_result)
def test_permission_enum(self): grantee = acls.Grantee(id='8a6925ce4adf588a4f21c32aa379004fef', display_name='*****@*****.**') acls.Grant(grantee, 'FULL_CONTROL') acls.Grant(grantee, 'WRITE') acls.Grant(grantee, 'WRITE_ACP') acls.Grant(grantee, 'READ') acls.Grant(grantee, 'READ_ACP') self.assertRaises(ValueError, acls.Grant, grantee, 'GO_HOG_WILD')
def test_grantee_email_to_xml(self): grantee = acls.Grantee(email_address="*****@*****.**") xml_bytes = grantee.to_xml() self.assertEquals( xml_bytes, """\ <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\ xsi:type="AmazonCustomerByEmail"> <EmailAddress>[email protected]</EmailAddress> </Grantee> """)
def test_grantee_to_xml(self): grantee = acls.Grantee(id='8a6925ce4adf588a4f21c32aa379004fef', display_name='*****@*****.**') xml_bytes = grantee.to_xml() self.assertEquals( xml_bytes, """\ <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"> <ID>8a6925ce4adf588a4f21c32aa379004fef</ID> <DisplayName>[email protected]</DisplayName> </Grantee> """)
def test_grantee_uri_to_xml(self): grantee = acls.Grantee( uri='http://acs.amazonaws.com/groups/global/AuthenticatedUsers') xml_bytes = grantee.to_xml() self.assertEquals( xml_bytes, """\ <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\ xsi:type="Group"> <URI>http://acs.amazonaws.com/groups/global/AuthenticatedUsers</URI> </Grantee> """)