def test_upload_blob_with_kms():
    with tempfile.NamedTemporaryFile() as source_file:
        source_file.write(b'test')
        snippets.upload_blob_with_kms(BUCKET, source_file.name,
                                      'test_upload_blob_encrypted', KMS_KEY)
        bucket = storage.Client().bucket(BUCKET)
        kms_blob = bucket.get_blob('test_upload_blob_encrypted')
        assert kms_blob.kms_key_name.startswith(KMS_KEY)
def test_upload_blob_with_kms():
    with tempfile.NamedTemporaryFile() as source_file:
        source_file.write(b'test')
        snippets.upload_blob_with_kms(
            BUCKET,
            source_file.name,
            'test_upload_blob_encrypted',
            KMS_KEY)
        bucket = storage.Client().bucket(BUCKET)
        kms_blob = bucket.get_blob('test_upload_blob_encrypted')
        assert kms_blob.kms_key_name.startswith(KMS_KEY)
def test_upload_blob_with_kms():
    with tempfile.NamedTemporaryFile() as source_file:
        source_file.write(b'test')

        snippets.upload_blob_with_kms(BUCKET, source_file.name,
                                      'test_upload_blob_encrypted', KMS_KEY)