40 lines
2.4 KiB
Plaintext
40 lines
2.4 KiB
Plaintext
|
## Overview
|
||
|
|
||
|
Integration tests for status-go
|
||
|
|
||
|
## Table of Contents
|
||
|
|
||
|
- [Overview](#overview)
|
||
|
- [How to Install](#how-to-install)
|
||
|
- [How to Run](#how-to-run)
|
||
|
- [Running Tests](#running-tests)
|
||
|
- [Implementation details](#implementation-details)
|
||
|
|
||
|
## How to Install
|
||
|
|
||
|
* Install [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/)
|
||
|
- Checkout all listed contract repositories into one folder:
|
||
|
- [Status Network Token V2](https://github.com/status-im/status-network-token-v2)
|
||
|
- [Communities Contracts](https://github.com/status-im/communities-contracts?tab=readme-ov-file#installation-and-development)
|
||
|
* Add environment variable, path to contract repos e.g. `export PATH_TO_CONTRACT_REPOS=~/directory-with-every-contract-repo`
|
||
|
* Install [Python 3.10.14](https://www.python.org/downloads/)
|
||
|
* In `integration-tests` directory, run `pip install -r requirements.txt`
|
||
|
* **Optional (for test development)**: Use Python virtual environment for better dependency management. You can follow the guide [here](https://akrabat.com/creating-virtual-environments-with-pyenv/):
|
||
|
|
||
|
## How to Run
|
||
|
|
||
|
- In `integration-tests/tests` run `docker compose up --build`, as result:
|
||
|
* a container with [status-go as deamon](https://github.com/status-im/status-go/issues/5175) will be created with APIModules exposed on `0.0.0.0:3333`
|
||
|
* status-go will use [anvil](https://book.getfoundry.sh/reference/anvil/) as RPCURL with ChainID 31337
|
||
|
* also all Status-im contracts are going to be deployed to the new network
|
||
|
|
||
|
### Running Tests
|
||
|
* In `integration-tests/tests` directory run `pytest -m wallet`
|
||
|
|
||
|
## Implementation details
|
||
|
|
||
|
- Integration tests are implemented in `integration-tests/tests` based on [pytest](https://docs.pytest.org/en/8.2.x/)
|
||
|
- 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 the `result` field, 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 `integration-tests/schema_builder.py` by passing a response to the `CustomSchemaBuilder(schema_name).create_schema(response.json())` method, should be used only on test creation phase, please search `how to create schema:` to see an example in a test
|