Console tool for validating the Supplier API implementation
Project description
Supplier API Testing Tool
Requirements
Python 3.7+
Installation
pip install supplier-api-tester
Usage
The CLI Testing Tool supports both API v1.x and v2.x. By default, the CLI runs all the tests for API v2.x.
If you wish to test your API implementation based on the v1 specification then you can pass the argument --version
(or -v
) in the CLI to enable v1 testing.
For more details on how to test your v1-complaint implementation please refer to the API docs for V1.
For example, the following command will test your API implementation according to the v1 specification:
supplier_products -u 'http://localhost:8000' -k 'secret' -v 1
Listing the products catalog:
supplier_products -u 'http://localhost:8000' -k 'secret' -v 2
+---------+---------+-----------+------------+-------------+-------------------------------------------+-----------------------------------+-----------------------------------+
| ID | Name | Timeslots | Refundable | Cutoff time | Required Additional Order Data | Required Additional Visitors Data | Provides Pricing |
+---------+---------+-----------+------------+-------------+-------------------------------------------+-----------------------------------+-----------------------------------+
| A300-FX | A300-FX | True | True | 24 | | | True |
| A400-FX | A400-FX | True | False | 0 | pickup_location,passport_id | full_name,phone | False |
| A500-FX | A500-FX | False | True | 0 | pickup_location,passport_id,flight_number | | True |
| A550-FX | A550-FX | False | True | 10 | | email,date_of_birth | False |
| A600-FX | A600-FX | False | False | 0 | nationality | | False |
+---------+---------+-----------+------------+-------------+-------------------------------------------+-----------------------------------+-----------------------------------+
Listing the products catalog for API v1.x:
supplier_products -u 'http://localhost:8000' -k 'secret' -v 1
+---------+---------+-----------+------------+-------------+
| ID | Name | Timeslots | Refundable | Cutoff time |
+---------+---------+-----------+------------+-------------+
| A300-FX | A300-FX | True | True | 24 |
| A400-FX | A400-FX | True | False | 0 |
| A500-FX | A500-FX | False | True | 0 |
| A550-FX | A550-FX | False | True | 10 |
| A600-FX | A600-FX | False | False | 0 |
+---------+---------+-----------+------------+-------------+
Testing tool usage:
supplier_tester --help
Usage: supplier_tester [OPTIONS]
Test your Supplier API implementation
Options:
-u, --url TEXT [required]
-k, --api-key TEXT [required]
-p, --product-id TEXT Product ID to call tests on. Required with -a and -t flags
-t, --timeslots Use timeslots
-a, --availability Run availability tests
-r, --reservation Run reservation tests
-b, --booking Run booking tests
-c, --catalog Run product catalog tests
-nc, --no-colors Not using colors on output
-v, --version Choosing the API version
--help Show this message and exit
Running all tests:
supplier_tester -u 'http://localhost:8000' -k 'secret' -p 'A500-FX' -v 2
Running only availability tests:
supplier_tester -u 'http://localhost:8000' -k 'secret' -p 'A500-FX' -a -v 2
Test example:
supplier_tester -u 'http://localhost:8000' -k 'secret' -p 'A500-FX' -v 2
------------------
AVAILABILITY TESTS
------------------
+----+-------+---------------------------------------------------+
| # | Time | Test name |
+----+-------+---------------------------------------------------+
| 1 | 28ms | Checking availability for the next 30 days |
| 2 | 4ms | Request without API-Key |
| 3 | 9ms | Request with incorrect API-Key |
| 4 | 23ms | Testing missing argument errors |
| 5 | 8ms | Testing availability for non existing product |
| 6 | 19ms | Checking incorrect date format |
| 7 | 8ms | Checking incorrect range error |
| 8 | 8ms | Checking past date |
| 9 | 112ms | Checking huge date range |
| 10 | 23ms | Testing methods that are not allowed |
| 11 | 13ms | Testing optional price attribute in availability |
+----+-------+---------------------------------------------------+
-----------------
RESERVATION TESTS
-----------------
+---+------+-----------------------------------------------------------+
| # | Time | Test name |
+---+------+-----------------------------------------------------------+
| 1 | 5ms | Request without API-Key |
| 2 | 6ms | Request with incorrect API-Key |
| 3 | 33ms | Testing missing argument errors |
| 4 | 29ms | Reserving tickets for at least 1 variant |
| 5 | 30ms | Testing reservation for non-existing product |
| 6 | 47ms | Testing reservation with incorrect date format |
| 7 | 21ms | Testing reservation with past date |
| 8 | 34ms | Testing methods that are not allowed |
| 9 | 50ms | Testing reservation for product with provide_pricing=True |
+---+------+-----------------------------------------------------------+
-------------
BOOKING TESTS
-------------
+---+------+----------------------------------------+
| # | Time | Test name |
+---+------+----------------------------------------+
| 1 | 3ms | Booking without the reservation ID |
| 2 | 3ms | Booking without the API key |
| 3 | 3ms | Booking with incorrect API-Key |
| 4 | 15ms | Testing methods that are not allowed |
| 5 | 6ms | Booking with incorrect reservation ID. |
| 6 | 29ms | Booking tickets for at least 1 variant |
| 7 | 72ms | Perform booking that will be cancelled |
+---+------+----------------------------------------+
---------------
PRODUCT CATALOG
---------------
+---+------+---------------------+
| # | Time | Test name |
+---+------+---------------------+
| 1 | 7ms | Get product catalog |
+---+------+---------------------+
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file Supplier API tester-2.0.4.tar.gz
.
File metadata
- Download URL: Supplier API tester-2.0.4.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12201af1eb0a44504ca83aeb5236105c3cae0b9d3eac951471dc9c9d69cd9349 |
|
MD5 | 8d5d83181cce3809c178fc9e43a9a495 |
|
BLAKE2b-256 | aba1cc22778ac67435b92de94fa12071fdc4c53a967d1990c5062f564b5a25fc |
Provenance
File details
Details for the file Supplier_API_tester-2.0.4-py3-none-any.whl
.
File metadata
- Download URL: Supplier_API_tester-2.0.4-py3-none-any.whl
- Upload date:
- Size: 46.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f28ebe5c0c8d1153e181ef4e8542f46527a6caa5e11bbd808d6a62891e15049c |
|
MD5 | e11437ec8d23ddeaaaf51e55b157f0db |
|
BLAKE2b-256 | 03016f04a1f6ba0e917ad3c1f856d54e3e6da7f3a40733bd875535d43cbf71a6 |