These tests assume the Sindri API is functioning normally and you have a valid SINDRI_API_KEY
.
- In the parent directory of this repo, clone the sindri-resources repo:
git clone https://github.com/Sindri-Labs/sindri-resources.git
- Obtain a valid Sindri API Key. See sindri.app/docs for more information about creating a Sindri account.
- Configure your python environment (see below)
- Configure your environment variables (see below)
Ensure you have a python3 environment set up with dependent modules for Sindri SDK and testing:
requests
pytest
# Create virtual environment called `venv`
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate
# Install necessary modules
pip install poetry
poetry install
# Run `deactivate` to deactivate virtual environment
When running pytest
, these environment variables must be set in your environment. You may prefix your command with the environment variables as well. For example: SINDRI_API_KEY=your_api_key pytest
SINDRI_API_KEY=your_api_key
RequiredSINDRI_BASE_URL=https://sindri.app
Optional. Default value shown
You must be in the root directory of this repo: cd ..
Here are several options for running the pytest unit tests with environment variables:
export SINDRI_API_KEY=your_api_key
export SINDRI_BASE_URL=https://sindri.app
pytest
SINDRI_API_KEY=your_api_key SINDRI_BASE_URL=https://sindri.app pytest
If you are running the Sindri api locally at ~/myproject
with ~/myproject/API_KEY
file populated with a valid api key, you can invoke the pytest
unit tests to hit your local Sindri API instance with:
SINDRI_BASE_URL=http://localhost SINDRI_API_KEY=$(cat ~/myproject/API_KEY) pytest
Add the -s
flag to pytest
to print standard output to the terminal for successful tests.