Skip to content

Commit 45b23b8

Browse files
committed
BACK-3396: fix unit test
1 parent 9693f8d commit 45b23b8

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

offchain/metadata/adapters/data_uri.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def decode_data_url(data_url): # type: ignore[no-untyped-def]
1818
decoded_data = base64.b64decode(data)
1919
decoded_text = decoded_data.decode("utf-8")
2020
return decoded_text
21-
elif "json;utf8" in data_parts[0] or "json" in data_parts[0]:
21+
elif "json" in data_parts[0]:
2222
decoded_data = urlopen(data_url).read()
2323
decoded_text = json.dumps(json.loads(decoded_data))
2424
return decoded_text

tests/metadata/fetchers/test_metadata_fetcher.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ async def test_gen_fetch_data_adapter(self): # type: ignore[no-untyped-def]
2828

2929
@pytest.mark.asyncio
3030
async def test_gen_fetch_ipfs_adapter(self): # type: ignore[no-untyped-def]
31-
fetcher = MetadataFetcher()
31+
fetcher = MetadataFetcher(
32+
async_adapter_configs=[
33+
AdapterConfig(
34+
adapter_cls=IPFSAdapter,
35+
mount_prefixes=[
36+
"ipfs://",
37+
],
38+
host_prefixes=["https://ipfs.decentralized-content.com/ipfs/"],
39+
),
40+
]
41+
)
3242
content = await fetcher.gen_fetch_content(
3343
"ipfs://bafkreiboyxwytfyufln3uzyzaixslzvmrqs5ezjo2cio2fymfqf6u57u6u" # noqa
3444
)

0 commit comments

Comments
 (0)