Exemplo n.º 1
0
def test_download_blob(test_blob):
    test_blob_name, test_blob_content = test_blob
    with tempfile.NamedTemporaryFile() as dest_file:
        encryption.download_encrypted_blob(BUCKET, test_blob_name,
                                           dest_file.name, TEST_ENCRYPTION_KEY)

        downloaded_content = dest_file.read().decode('utf-8')
        assert downloaded_content == test_blob_content
Exemplo n.º 2
0
def test_download_blob(test_blob, cloud_config):
    test_blob_name, test_blob_content = test_blob
    with tempfile.NamedTemporaryFile() as dest_file:
        encryption.download_encrypted_blob(
            cloud_config.storage_bucket,
            test_blob_name,
            dest_file.name,
            TEST_ENCRYPTION_KEY)

        downloaded_content = dest_file.read().decode('utf-8')
        assert downloaded_content == test_blob_content
def test_rotate_encryption_key(test_blob, cloud_config):
    test_blob_name, test_blob_content = test_blob
    encryption.rotate_encryption_key(cloud_config.storage_bucket,
                                     test_blob_name, TEST_ENCRYPTION_KEY,
                                     TEST_ENCRYPTION_KEY_2)

    with tempfile.NamedTemporaryFile() as dest_file:
        encryption.download_encrypted_blob(cloud_config.storage_bucket,
                                           test_blob_name, dest_file.name,
                                           TEST_ENCRYPTION_KEY_2)

        downloaded_content = dest_file.read().decode('utf-8')
        assert downloaded_content == test_blob_content
def test_rotate_encryption_key(test_blob):
    test_blob_name, test_blob_content = test_blob
    encryption.rotate_encryption_key(
        BUCKET,
        test_blob_name,
        TEST_ENCRYPTION_KEY,
        TEST_ENCRYPTION_KEY_2)

    with tempfile.NamedTemporaryFile() as dest_file:
        encryption.download_encrypted_blob(
            BUCKET,
            test_blob_name,
            dest_file.name,
            TEST_ENCRYPTION_KEY_2)

        downloaded_content = dest_file.read().decode('utf-8')
        assert downloaded_content == test_blob_content