def test_private(self, mock_connection): content = ''' <AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Owner> <ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID> <DisplayName>[email protected]</DisplayName> </Owner> <AccessControlList> <Grant> <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"> <ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID> <DisplayName>[email protected]</DisplayName> </Grantee> <Permission>FULL_CONTROL</Permission> </Grant> </AccessControlList> </AccessControlPolicy> ''' mock_server = MockConnection() mock_connection.return_value = mock_server mock_server.mock_add_request(MockResponse('GET', 'https://localhost:9000/hello/?acl', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=content)) client = Minio('localhost:9000') acl = client.get_bucket_acl('hello') eq_(Acl.private(), acl)
def test_set_bucket_acl_works(self, mock_connection): mock_server = MockConnection() mock_connection.return_value = mock_server mock_server.mock_add_request(MockResponse('PUT', 'http://localhost:9000/hello/?acl', {'x-amz-acl': 'private', 'User-Agent': _DEFAULT_USER_AGENT}, 200)) client = Minio('http://localhost:9000') client.set_bucket_acl('hello', Acl.private())
def test_set_bucket_acl_invalid_name(self): client = Minio('http://localhost:9000') client.set_bucket_acl('ABCD', Acl.private())
def test_bucket_is_not_empty_string(self): client = Minio('http://localhost:9000') client.set_bucket_acl(' \t \n ', Acl.private())
def test_bucket_is_string(self): client = Minio('http://localhost:9000') client.set_bucket_acl(1234, Acl.private())