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.3.9.tar.gz
(10.4 kB
view details)
Built Distribution
File details
Details for the file im_swagger_spy-0.3.9.tar.gz
.
File metadata
- Download URL: im_swagger_spy-0.3.9.tar.gz
- Upload date:
- Size: 10.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 | fff92e39501238aa3cd80056d14bb13ebc5dd1a8d6715fe1fe9d3a599c786ede |
|
MD5 | 7343fb30139351f74557bf48bbeb7788 |
|
BLAKE2b-256 | 2e2123936e6bb9845ffca8dec1c280a67d0e19eef6a76f5d5748d5ab8c5dc1e7 |
File details
Details for the file im_swagger_spy-0.3.9-py3-none-any.whl
.
File metadata
- Download URL: im_swagger_spy-0.3.9-py3-none-any.whl
- Upload date:
- Size: 10.5 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 | caa136d884dd363b3ad219fa5b7cdb0ceadefe28ebe4709775114e3dfc856b76 |
|
MD5 | 8e41cb254eb76989abfb89ca9c6b8c18 |
|
BLAKE2b-256 | fab84b9265ceb06d0cf0f5b3180d4ff87a900930a5463fd737fbd847f898e185 |