PyPony
PyPony is a 🪄magical🪄 Python CLI tool for contract testing OpenAPI specifications against the live APIs that they define.
Supported OAS Features
- JSON or YAML
- enums
- $ref
- oneOf
Install Locally
make install-dependencies
make install-cli
Remove Local Installation
make remove-cli
Test
make test
Generate Coverage Report
make test-coverage
Run
pypony -st ./my_steps.yml -sp ./my_spec.yml -v
Arguments
| Argument | Description |
|---|---|
| '-st', '--step' | Relative path to step file |
| '-sp', '--spec' | Relative path to spec file |
| '-v', '--verbose' | Boolean verbose output (default=False) |
| '-ff', '--fail-fast' | Option to fail fast if an exception is encountered (default=False) |
Step File
The step file is what is used to make API calls - its where you provide information like base url, auth, path, request body, etc. PyPony uses the information in the step file to check against the OpenAPI spec, ensuring it matches the definiution, and then sends it using the requests library.
Step files export expressions and environment variables, allowing it to be run in a CI/CD pipeline and making data from previous steps accessible.
Required Step File Fields
- BaseURL
- Steps
- name
- operation_id
- method
- path
- status_code
Example Step File
---
base_url: https://voice.bandwidth.com/api/v2
auth:
username: ${{ env.BW_USERNAME }}
password: ${{ env.BW_PASSWORD }}
steps:
- name: createCall
operation_id: createCall
method: POST
path: /accounts/${{ env.BW_ACCOUNT_ID }}/calls
headers:
Content-Type: application/json
body:
to: ${{ env.USER_NUMBER }}
from: ${{ env.BW_NUMBER }}
applicationId: ${{ env.BW_VOICE_APPLICATION_ID }}
answerUrl: ${{ env.BW_ANSWER_URL }}
status_code: 201
- name: Get Call Info
operation_id: getCallState
method: GET
path: /accounts/${{ env.BW_ACCOUNT_ID }}/calls/${{ steps.createCall.response.data.callId }}
auth: # overrides global auth definition
username: ${{ env.VOXBONE_USERNAME }}
password: ${{ env.VOXBONE_PASSWORD }}
status_code: 200
- name: listConferences
operation_id: listConferences
method: GET
path: /accounts/${{ env.BW_ACCOUNT_ID }}/conferences
status_code: 200
The full step file schema can be found here.
Metadata
Release files for pypony 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pypony-1.0.0.tar.gz | 12.4 kB | Without provenance | Details for pypony-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pypony-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pypony-1.0.0-py3-none-any.whl |
Total release size: 30.0 kB
Release files / pypony-1.0.0.tar.gz
| Download URL | pypony-1.0.0.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67fdb8a39668bf3854542cf66df24343c08d096229327c133073b393d31d86db
|
|
BLAKE2b-256 checksum How to use checksums |
fcd97fb68b3c3df171ab78816984d11aa05f04806a66e095dd8f15d89a66447b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / pypony-1.0.0-py3-none-any.whl
| Download URL | pypony-1.0.0-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a30ce267049bc2c54710b1cf391d92b2cb85d34fe0b51a4015a27fa9d8cb7a16
|
|
BLAKE2b-256 checksum How to use checksums |
005ae9f23509040728b98ff51a050c801b4720e2e5299c706e9683cfb1d29b48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for pypony 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.