im-swagger-spy: pytest plugin for matching methods in swagger with those used in tests
Project description
im-swagger-spy
pytest plugin for matching methods in swagger with those used in tests
Установка
pip install git+https://github.com/dasshit/im-swagger-spy.git
Использование
Есть несколько вариантов использования
Вариант №1
pytest.ini
[pytest]
addopts = --swagger-url http://localhost/client/v101/u/api.yaml # Адрес, с которого можно получить swagger.json|yaml или openapi.json|yaml
--swagger-prefix /api/v101 # Префикс к path методов из документации
--swagger-name test.ru # Название сервиса (для отчета)
--swagger-report reports/ # Путь к папке для сохранения отчета
conftest.py
import pytest
import requests
@pytest.fixture(scope='session')
def session(swagger_http_spy):
session = requests.Session()
swagger_http_spy.register_as_hook(session)
yield session # Запросы этой сессии попадут в отчет
CI
pytest tests/
python -m im_swagger_spy build
Другие примеры
Можно посмотреть в example/
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
im_swagger_spy-0.4.0.tar.gz
(10.4 kB
view details)
Built Distribution
File details
Details for the file im_swagger_spy-0.4.0.tar.gz
.
File metadata
- Download URL: im_swagger_spy-0.4.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d88a5eab795e2b73fee6249f08b87fb0ac308c90ea96eef55c5164ce655b6c82 |
|
MD5 | 72fe4f72bdcedb41cde4cd8e35af5c76 |
|
BLAKE2b-256 | 31dca9c06b03b40cca1be4b92de90a07b78315e7ba3a9189b718cff2d0d43e47 |
File details
Details for the file im_swagger_spy-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: im_swagger_spy-0.4.0-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a20dd5c606e0e7930b9aeabb30055d4c2730fec614d4b1e60c1de3c43cba6a7e |
|
MD5 | 74affa7f738b3029b212ac80317849d0 |
|
BLAKE2b-256 | cea9f3c1d9ab64d623164d28a8e4dbaf98a8c3b2367f3514bf0a5fcd33cb0d23 |