This repository contains smoke tests and sanity checks for all live IATI websites and web tools.
The output of tests can be seen at: https://travis-ci.org/IATI/IATI-Website-Tests
Tests are written using pytest using Python 3.7.
Most tests are designed to obtain HTML and associated content from IATI websites, using the requests library. This retries failed requests several times should a failure occur, so as to reduce flakiness. Additional tests on the status of backups are made using the paramiko module, which checks the status of expected backup files via an SSH connection.
These tests are run daily (at around 2pm) using Travis cron jobs. They are also run every 15 minutes throughout the day by use of a Travis API call from an IATI-managed server.
For a more detailed of the test architecture, view the README under tests.
The current status of the tests can be seen on the Travis site.
# Create a virtual environment using python 3
python3 -m venv pyenv
# Activate the virtual environment
source pyenv/bin/activate
# Install requirements
pip install -r requirements.txt
# Login credentials for the IATI backup server are stored as environment variables.
# Add these lines to the end of your virtualenv set-up script - i.e. pyenv/bin/activate
export backup_server_hostname='[YOUR_HOSTNAME]'
export backup_server_username='[YOUR_USERNAME]'
export backup_server_password='[YOUR_PASSWORD]'
# Run the tests
py.test tests/