Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test for File Uploads
- minting an nft where the metadata[“image”] is a file results in that property being replaced with the IPFS hash and the image gets uploaded

- minting an nft where the metadata[“image”] is a string just uploads the metadata like normal
  • Loading branch information
ayshptk committed Nov 15, 2021
commit acd35a5364af1e912f4a94b1b567f70d24e0492c
Binary file added tests/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions tests/test_storage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import unittest
from nftlabs import NftlabsSdk, SdkOptions, MintArg
from nftlabs.storage import ipfs_storage
from test_constants import (TEST_NFT_CONTRACT_ADDRESS)
import os, io

class TestStorage(unittest.TestCase):
def test():
sdk = NftlabsSdk(SdkOptions(
private_key=environ['PKEY']
), "https://rpc-mumbai.maticvigil.com")

nft_module = sdk.get_nft_module(
"0xe76Fc319fD15a92328bAE16D3320F6ceB20759C6")

# mint by uploading a file
with open(file='test.png', mode='rb') as f:
print(nft_module.mint(MintArg(name="example",
description="example nft!", image=f, properties={})))

# mint by providing a string
print(nft_module.mint(MintArg(name="example", description="example nft!",
image="ipfs://QmYWi4mkEjsL6MYoS8z2ZWPAhyDPNjPQ2pqg8MGEM1CaeQ", properties={})))


if __name__ == '__main__':
unittest.main()