Writing the tests
Before you jump into testing the NFT marketplace, you need an NFT to trade! Testing your NFT marketplace smart contract requires you to have an NFT smart contract as well. You can get the NFT smart contract from the previous chapter or download it from https://github.com/PacktPublishing/Hands-On-Blockchain-for-Python-Developers--2nd-Edition/blob/main/chapter_14/nft_marketplace/contracts/HelloNFT.vy.
Put HelloNFT.vy
inside the contracts
folder, then compile the NFT smart contract as follows:
(.venv) $ ape compile
Then let’s set up the fixture test file by creating a file named conftest.py
inside the tests folder and add the following code to it:
import pytest @pytest.fixture def deployer(accounts): return accounts[0] @pytest.fixture def marketplace_contract(deployer, project): return deployer.deploy(project.NFTMarketplace) @pytest.fixture def nft_contract(deployer, project): return...