Functional tests for status-go
- Install Docker and Docker Compose
- Install Python 3.10.14
- In
./tests-functional, runpip install -r requirements.txt - Optional (for test development): Use Python virtual environment for better dependency management. You can follow the guide here:
- In
./tests-functionalrundocker compose -f docker-compose.anvil.yml up --remove-orphans --build, as result:- an anvil container with ChainID 31337 exposed on
0.0.0.0:8545will start running - Status-im contracts will be deployed to the network
- an anvil container with ChainID 31337 exposed on
- In
./tests-functionalrundocker compose -f docker-compose.anvil.yml -f docker-compose.test.status-go.yml -f docker-compose.status-go.local.yml up --build --scale status-backend=10 --remove-orphans, as result:- a container with status-go as daemon will be created with APIModules exposed on
0.0.0.0:3333 - status-go will use anvil as RPCURL with ChainID 31337
- all Status-im contracts will be deployed to the network
- a container with status-go as daemon will be created with APIModules exposed on
- In
./tests-functional/testsdirectory runpytest -m wallet
- Functional tests are implemented in
./tests-functional/testsbased on pytest - Every test has two types of verifications:
verify_is_valid_json_rpc_response()checks for status code 200, non-empty response, JSON-RPC structure, presence of theresultfield, and expected ID.jsonschema.validate()is used to check that the response contains expected data, including required fields and types. Schemas are stored in/schemas/wallet_MethodName- New schemas can be generated using
./tests-functional/schema_builder.pyby passing a response to theCustomSchemaBuilder(schema_name).create_schema(response.json())method, should be used only on test creation phase, please searchhow to create schema:to see an example in a test