Skip to main content

Console tool for validating the Supplier API implementation

Project description

Supplier API Testing Tool

CLI tool screenshot

Requirements

Python 3.7+

Installation

pip install supplier-api-tester

Usage

Listing the products catalog:

supplier_products -u 'http://localhost:8000' -k 'secret'
+---------+---------+-----------+------------+-------------+
| 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 you 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
  --help                 Show this message and exit

Running all tests:

supplier_tester -u 'http://localhost:8000' -k 'secret' -p 'A500-FX'  # For products without timeslots
supplier_tester -u 'http://localhost:8000' -k 'secret' -p 'A400-FX' -t  # For products with timeslots

Remember to choose valid product id. It has to refer timeslotted product when you use -t flag.

Running only availability tests:

supplier_tester -u 'http://localhost:8000' -k 'secret' -p 'A500-FX' -a  # For products without timeslots
supplier_tester -u 'http://localhost:8000' -k 'secret' -p 'A400-FX' -a -t  # For products with timeslots

Test example:

supplier_tester -u 'http://localhost:8000' -k 'secret' -p 'A500-FX'

------------------
AVAILABILITY TESTS
------------------

+----+------+--------------------------------------------------------------+----------------------------+
| #  | Time | Test name                                                    | Description                |
+----+------+--------------------------------------------------------------+----------------------------+
| 1  | 5ms  | [Variants] Checking response format                          |                            |
| 2  | 10ms | [Variants] Checking for any availability in the next 30 days |                            |
| 3  | 3ms  | [Variants] Request without API-Key                           |                            |
| 4  | 3ms  | [Variants] Request with incorrect API-Key                    |                            |
| 5  | 10ms | [Variants] Testing missing argument errors                   |                            |
| 6  | 3ms  | [Variants] Testing availability for non existing product     |                            |
| 7  | 6ms  | [Variants] Checking incorrect date format                    |                            |
| 8  | 3ms  | [Variants] Checking incorrect range error                    |                            |
| 9  | 4ms  | [Variants] Checking past date                                |                            |
| 10 | 3ms  | [Variants] Checking huge date range                          |                            |
| 11 | 3ms  | [Variants] Checking empty availability                       | Skipping that test because |
|    |      |                                                              | response is not empty.     |
| 12 | 14ms | [Variants] Testing methods that are not allowed              |                            |
| 13 | 3ms  | [Timeslots] Testing errors on invalid (non-timeslot) product |                            |
+----+------+--------------------------------------------------------------+----------------------------+

-----------------
RESERVATION TESTS
-----------------

+---+------+------------------------------------------------+
| # | Time | Test name                                      |
+---+------+------------------------------------------------+
| 1 | 3ms  | Request without API-Key                        |
| 2 | 4ms  | Request with incorrect API-Key                 |
| 3 | 21ms | Testing missing argument errors                |
| 4 | 3ms  | Reserving tickets for at least 1 variant       |
| 5 | 4ms  | Testing reservation for non-existing product   |
| 6 | 4ms  | Testing reservation with incorrect date format |
| 7 | 3ms  | Testing reservation with past date             |
| 8 | 13ms | Testing methods that are not allowed           |
+---+------+------------------------------------------------+

-------------
BOOKING TESTS
-------------

+---+------+----------------------------------------+
| # | Time | Test name                              |
+---+------+----------------------------------------+
| 1 | 4ms  | Booking without the reservation ID     |
| 2 | 2ms  | Booking without the API key            |
| 3 | 4ms  | Booking with incorrect API-Key         |
| 4 | 13ms | Testing methods that are not allowed   |
| 5 | 3ms  | Booking with incorrect reservation ID. |
| 6 | 7ms  | Booking tickets for at least 1 variant |
| 7 | 21ms | Perform booking that will be cancelled |
+---+------+----------------------------------------+

---------------
PRODUCT CATALOG
---------------

+---+------+-----------------------------------------------------------+
| # | Time | Test name                                                 |
+---+------+-----------------------------------------------------------+
| 1 | 4ms  | Get product catalog                                       |
| 2 | 3ms  | Get product catalog with use_timeslots=True query filter  |
| 3 | 3ms  | Get product catalog with use_timeslots=False query filter |
+---+------+-----------------------------------------------------------+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Supplier API tester-1.6.4.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

Supplier_API_tester-1.6.4-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

Details for the file Supplier API tester-1.6.4.tar.gz.

File metadata

  • Download URL: Supplier API tester-1.6.4.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for Supplier API tester-1.6.4.tar.gz
Algorithm Hash digest
SHA256 0f4a2ca6cc96a808c70a3705c0a54e13725de756ff6120b47d862530f79c6424
MD5 cae562536aad541f8c17978c91ff59af
BLAKE2b-256 ccc49491b9ee5c54101aa5a970a79ec1b9cf94625e0dd225cdee6284bfb41804

See more details on using hashes here.

Provenance

File details

Details for the file Supplier_API_tester-1.6.4-py3-none-any.whl.

File metadata

  • Download URL: Supplier_API_tester-1.6.4-py3-none-any.whl
  • Upload date:
  • Size: 25.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for Supplier_API_tester-1.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e58c4b048c00a4892c3bb6df9ef01fa5e4a929837f3805858cdbfd77b40a26cd
MD5 85ce2a5e29afde934228eb305ab00ce5
BLAKE2b-256 e6e697072792fed688bfcb51b31197faf0c11c1218f05ebc7c11bc3b84fc4a0f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page