Пример #1
0
def test_s3_object_metadata_invalid_key():
    conn = boto.connect_s3()
    bucket = conn.create_bucket('source-bucket')

    s3 = S3()
    with pytest.raises(S3Error):
        s3.metadata('source-bucket', 'invalid-file')
Пример #2
0
def test_s3_object_metadata():
    conn = boto.connect_s3()
    bucket = conn.create_bucket('source-bucket')
    key = Key(bucket, 'test-file')
    key.content_type = 'text/plain'
    key.set_contents_from_string('Hello World')

    s3 = S3()
    assert {'Content-Type': 'text/plain; charset=utf-8'} == s3.metadata('source-bucket', 'test-file')