Add & use tag_set_to_dict (#2700)

This commit is contained in:
Asher Foa
2025-06-12 21:41:48 -04:00
committed by GitHub
parent 5ce86034cd
commit 47cf755d9c
2 changed files with 7 additions and 2 deletions

View File

@@ -338,4 +338,9 @@ class S3Uri:
return self._parsed.geturl()
def tag_set_to_dict(tag_set: list[dict[str, str]]) -> dict[str, str]:
"""Convert a list of tags to a dictionary."""
return {tag["Key"]: tag["Value"] for tag in tag_set}
aws_client = AsyncAWSClient()

View File

@@ -9,7 +9,7 @@ from moto.server import ThreadedMotoServer
from types_boto3_s3.client import S3Client
from skyvern.config import settings
from skyvern.forge.sdk.api.aws import S3StorageClass, S3Uri
from skyvern.forge.sdk.api.aws import S3StorageClass, S3Uri, tag_set_to_dict
from skyvern.forge.sdk.artifact.models import Artifact, ArtifactType, LogEntityType
from skyvern.forge.sdk.artifact.storage.s3 import S3Storage
from skyvern.forge.sdk.artifact.storage.test_helpers import (
@@ -160,7 +160,7 @@ def _assert_object_meta(boto3_test_client: S3Client, uri: str) -> None:
obj_meta = boto3_test_client.head_object(Bucket=TEST_BUCKET, Key=s3uri.key)
assert obj_meta["StorageClass"] == "ONEZONE_IA"
s3_tags_resp = boto3_test_client.get_object_tagging(Bucket=TEST_BUCKET, Key=s3uri.key)
tags_dict = {tag["Key"]: tag["Value"] for tag in s3_tags_resp["TagSet"]}
tags_dict = tag_set_to_dict(s3_tags_resp["TagSet"])
assert tags_dict == {"dummy": f"org-{TEST_ORGANIZATION_ID}", "test": "jerry"}