Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (44 sloc) 1.46 KB

Testing Your Contracts

Testing your contracts with SolidByte is pretty straight forward. SolidByte uses pytest as a test runner and provides some useful fixtures to help ease testing.

Fixtures

contracts

The contracts fixture is an :class:`attrdict.AttrDict` instance with all of your deployed contracts as :class:`web3.contract.Contract` instances.

web3

This is the initialized instance of :class:`web3.Web3` that should already be connected to whatever network you gave on the CLI.

local_accounts

list of addresses of the known local accounts.

std_tx

Function to update a transaction dict with standard values.

.. autofunction:: solidbyte.testing.fixtures.std_tx

has_event

Function to check if a receipt contains an event.

.. autofunction:: solidbyte.testing.fixtures.has_event

get_event

Function to pull the event data from a receipt.

.. autofunction:: solidbyte.testing.fixtures.get_event

Example Test

Here's an example test provided with the erc20 template:

.. literalinclude:: ../solidbyte/templates/templates/erc20/tests/test_erc20.py
    :pyobject: test_erc20
You can’t perform that action at this time.