Skip to content

Python API test framework example

Notifications You must be signed in to change notification settings

Urbelis/protonvpn-server-tests

Repository files navigation

Link

ProtonVPN server tests

Actions Status

API tests for ProtonVPN services written in Python using requests lib.

Prerequisites

You will need to install Python 3.7

Installation

Get the repository:

$ git clone https://github.com/Urbelis/protonvpn-server-tests.git

Install the dependancies:

$ pip install -r requirements.txt

Running the tests

Launch tests:

$ pytest

Run the server status check:

$ python server_status.py

Server status check will generate log files in ~/logs directory listing servers that are offline or under high load

Developing new tests

  1. Create a test file under /tests directory in the following format: test_*.py otherwise pytest runner will ignore it
  2. If the endpoint is new, add a new endpoint class under ~/endpoints
  3. Create a new service class under ~/services

The current project structure is:

├───.github
│   └───workflows
|       └───pythonapp.yml
├───endpoints
│   └───vpn.py
├───logs
|   └───20190909-080528
├───schemas
|   └───logical_servers.json
├───services
│   └───vpn.py
├───tests
│   └───test_servers.py
├───utils
|    └───helpers.py
├── config.py
├── requirements.txt
├── server_status.py
├── .gitignore
└── README.md

Configuring automatic builds

Automatic nightly builds are currently configured to run via Github Actions

If you want to make changes to the workflow, check this page