Skip to content

Commit

Permalink
updated for tests and a quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickAlphaC committed Mar 30, 2021
1 parent b924dbb commit ff1e272
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<br/>
<p align="center">
<a href="https://chain.link" target="_blank">
<img src="https://raw.githubusercontent.com/smartcontractkit/chainlink-mix/master/img/chainlink-brownie.png" width="225" alt="Chainlink Brownie logo">
<img src="https://raw.githubusercontent.com/PatrickAlphaC/nft-mix/main/img/pug.png" width="225" alt="NFT Pug">
</a>
</p>
<br/>
Expand Down Expand Up @@ -67,8 +67,8 @@ The simple collectibles work on a local network, however the advanced requires

# For the Simple ERC721
```
brownie run scripts/simple_collectible/deploy_simple.py
brownie run scripts/simple_collectible/create_collectible.py
brownie run scripts/simple_collectible/deploy_simple.py --network rinkeby
brownie run scripts/simple_collectible/create_collectible.py --network rinkeby
```

# For the Advanced ERC721
Expand Down
1 change: 1 addition & 0 deletions contracts/AdvancedCollectible.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ contract AdvancedCollectible is ERC721, VRFConsumerBase {
Breed breed = Breed(randomNumber % 3);
tokenIdToBreed[newItemId] = breed;
requestIdToTokenId[requestId] = newItemId;
tokenCounter = tokenCounter + 1;
}
}
Binary file added img/pug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 19 additions & 2 deletions tests/test_advanced_collectible.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,22 @@
from brownie import network, AdvancedCollectible, convert


def test_can_create_simple_collectible(get_account):
pass
def test_can_create_advanced_collectible(get_account, get_vrf_coordinator, get_keyhash,
get_link_token, chainlink_fee, get_seed):
# Arrange
if network.show_active() not in ['development'] or 'fork' in network.show_active():
pytest.skip('Only for local testing')
advanced_collectible = AdvancedCollectible.deploy(
get_vrf_coordinator.address, get_link_token.address, get_keyhash, {'from': get_account})
get_link_token.transfer(advanced_collectible.address,
chainlink_fee * 3, {'from': get_account})
# Act
transaction_receipt = advanced_collectible.createCollectible(
"None", get_seed, {'from': get_account})
requestId = transaction_receipt.events['requestedCollectible']['requestId']
assert isinstance(transaction_receipt.txid, str)
get_vrf_coordinator.callBackWithRandomness(
requestId, 777, advanced_collectible.address, {'from': get_account})
# Assert
assert advanced_collectible.tokenCounter() > 0
assert isinstance(advanced_collectible.tokenCounter(), int)

0 comments on commit ff1e272

Please sign in to comment.