Ejemplo n.º 1
0
def test_it_handles_versions_for_get_acl(mock_requester):
    get_object_info.cache_clear()
    client = MagicMock()
    mock_requester.return_value = {}, {}
    client.get_object_tagging.return_value = {
        "Owner": {
            "ID": "a"
        },
        "Grants": [
            {
                "Grantee": {
                    "ID": "b",
                    "Type": "CanonicalUser"
                },
                "Permission": "READ"
            },
            {
                "Grantee": {
                    "ID": "c",
                    "Type": "CanonicalUser"
                },
                "Permission": "READ_ACP"
            },
        ],
    }
    get_object_acl(client, "bucket", "key")
    client.get_object_acl.assert_called_with(Bucket="bucket", Key="key")
    get_object_acl(client, "bucket", "key", "abc123")
    client.get_object_acl.assert_called_with(Bucket="bucket",
                                             Key="key",
                                             VersionId="abc123")
Ejemplo n.º 2
0
def test_it_handles_versions_for_get_tagging(mock_requester):
    get_object_info.cache_clear()
    client = MagicMock()
    mock_requester.return_value = {}, {}
    client.get_object_tagging.return_value = {"TagSet": []}
    get_object_tags(client, "bucket", "key")
    client.get_object_tagging.assert_called_with(Bucket="bucket", Key="key")
    get_object_tags(client, "bucket", "key", "abc123")
    client.get_object_tagging.assert_called_with(Bucket="bucket",
                                                 Key="key",
                                                 VersionId="abc123")
Ejemplo n.º 3
0
def test_it_returns_standard_info(mock_requester):
    get_object_info.cache_clear()
    client = MagicMock()
    mock_requester.return_value = {}, {}
    stub = {
        "CacheControl": "cache",
        "ContentDisposition": "content_disposition",
        "ContentEncoding": "content_encoding",
        "ContentLanguage": "content_language",
        "ContentType": "ContentType",
        "Expires": "123",
        "Metadata": {
            "foo": "bar"
        },
        "ServerSideEncryption": "see",
        "StorageClass": "STANDARD",
        "SSECustomerAlgorithm": "aws:kms",
        "SSEKMSKeyId": "1234",
        "WebsiteRedirectLocation": "test",
    }
    client.head_object.return_value = stub
    assert stub == get_object_info(client, "bucket", "key")[0]