Python client for Kiwi TCMS JSON-RPC API
Project description
kiwi-tcms-api
Python-клиент для работы с Kiwi TCMS через JSON-RPC API.
Установка
pip install kiwi-tcms-api
Возможности
- Подключение с авторизацией через сессию (CSRF + Cookie)
- 4 способа инициализации клиента
- Конфигурация через переменные окружения
- Полное покрытие официального API: TestCase, TestRun, TestPlan, TestExecution, Product, Build, User и др.
- Два стиля вызова: именованные методы и dot-нотация (
rpc.Product.filter()) - Поддержка самоподписанных SSL-сертификатов
Установка зависимостей
pip install requests beautifulsoup4
Быстрый старт
from kiwi_tcms_api import KiwiTCMSApi
rpc = KiwiTCMSApi(url='https://tcms.example.com', username='admin', password='secret')
# Получить список продуктов
products = rpc.Product_filter()
# Создать тест-ран
run = rpc.TestRun_create({
'summary': 'Smoke Tests',
'plan': 1,
'build': 1,
'manager': 1,
})
Способы инициализации
# 1. Из переменных окружения
rpc = KiwiTCMSApi()
# 2. Явные параметры
rpc = KiwiTCMSApi(url='https://tcms.example.com', username='admin', password='secret')
# 3. Отложенное подключение
rpc = KiwiTCMSApi.configure(url='https://tcms.example.com', username='admin', password='secret')
rpc.connect()
# 4. Из словаря конфигурации
cfg = {'url': 'https://tcms.example.com', 'username': 'admin', 'password': 'secret'}
rpc = KiwiTCMSApi.from_config(cfg)
Переменные окружения
| Переменная | По умолчанию | Описание |
|---|---|---|
KIWI_TCMS_API_URL |
http://localhost:8000 |
URL сервера Kiwi TCMS |
KIWI_TCMS_API_USERNAME |
— | Имя пользователя |
KIWI_TCMS_API_PASSWORD |
— | Пароль |
KIWI_TCMS_API_VERIFY_SSL |
true |
Проверка SSL-сертификата (false для самоподписанных) |
Стили вызова методов
# Именованный метод
rpc.TestCase_filter({'product': 1})
# Dot-нотация (модуль.метод)
rpc.TestCase.filter({'product': 1})
# Прямой вызов exec
rpc.exec('TestCase.filter', [{'product': 1}])
Покрытие API
| Модуль | Методы |
|---|---|
Auth |
login, logout |
TestCase |
create, filter, update, remove, add/remove tag/component/attachment/comment/property и др. |
TestPlan |
create, filter, update, add/remove case/tag/attachment, tree |
TestRun |
create, filter, update, add/remove case/tag/cc/attachment/property |
TestExecution |
create, filter, update, add/remove comment/link/attachment/property |
TestCaseStatus |
create, filter |
TestExecutionStatus |
create, filter |
Product |
create, filter |
Build |
create, filter, update |
Version |
create, filter |
Component |
create, filter, update |
Category |
create, filter |
Environment |
create, filter, add/remove property |
User |
filter, update, deactivate, join_group, add_attachment |
Group |
filter, permissions, users |
Bug |
details, report |
BugTracker |
create, filter |
Tag |
create, filter |
Template |
create, filter |
PlanType |
create, filter |
Priority |
create, filter |
Classification |
create, filter |
Attachment |
remove_attachment |
Markdown |
render |
Kiwitcms |
version |
Utils |
tracker_from_url |
Примеры
Создание тест-кейса и добавление в план
rpc = KiwiTCMSApi()
case = rpc.TestCase_create({
'summary': 'Проверка авторизации',
'product': 1,
'category': 1,
'priority': 1,
'case_status': 2,
})
rpc.TestPlan_add_case(plan_id=5, case_id=case['id'])
Обновление статуса выполнения
rpc.TestExecution_update(execution_id=42, values={'status': 4})
Добавление ссылки к выполнению
rpc.TestExecution_add_link({
'execution': 42,
'url': 'https://jira.example.com/browse/BUG-123',
'name': 'BUG-123',
})
Отключение проверки SSL (самоподписанный сертификат)
rpc = KiwiTCMSApi(url='https://tcms.internal', username='admin', password='secret', verify_ssl=False)
# или через переменную окружения:
# KIWI_TCMS_API_VERIFY_SSL=false
Диагностика доступных методов
rpc.discover_methods()
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kiwi_tcms_api-0.0.1.tar.gz.
File metadata
- Download URL: kiwi_tcms_api-0.0.1.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68c31a79b2d29a92dc07152d70c3e7dbf9a3aa796bbf0185fe4c524231e95c29
|
|
| MD5 |
b8c231df646d8c65b6a71428edb4b002
|
|
| BLAKE2b-256 |
327c7a8345857a20da6818f581ba7c6d77e18955908ee821099c6655b4a8795b
|
Provenance
The following attestation bundles were made for kiwi_tcms_api-0.0.1.tar.gz:
Publisher:
publish.yml on alekseyvm/kiwi-tcms-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kiwi_tcms_api-0.0.1.tar.gz -
Subject digest:
68c31a79b2d29a92dc07152d70c3e7dbf9a3aa796bbf0185fe4c524231e95c29 - Sigstore transparency entry: 1135335668
- Sigstore integration time:
-
Permalink:
alekseyvm/kiwi-tcms-api@fdd3169f0c97b69eedbfdfeac852e972c57d4c39 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/alekseyvm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fdd3169f0c97b69eedbfdfeac852e972c57d4c39 -
Trigger Event:
release
-
Statement type:
File details
Details for the file kiwi_tcms_api-0.0.1-py3-none-any.whl.
File metadata
- Download URL: kiwi_tcms_api-0.0.1-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd206e10a9f159f596a4df616558a77d8cf4a62f3de7702e2f30be8ef94fe6af
|
|
| MD5 |
7cabce8d35771429ab9f9cb8ce60d4e1
|
|
| BLAKE2b-256 |
82c83246f02f940e8d2babe99a9b7a36028b9e9f706bb5023f4d84d89c70f15d
|
Provenance
The following attestation bundles were made for kiwi_tcms_api-0.0.1-py3-none-any.whl:
Publisher:
publish.yml on alekseyvm/kiwi-tcms-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kiwi_tcms_api-0.0.1-py3-none-any.whl -
Subject digest:
cd206e10a9f159f596a4df616558a77d8cf4a62f3de7702e2f30be8ef94fe6af - Sigstore transparency entry: 1135335727
- Sigstore integration time:
-
Permalink:
alekseyvm/kiwi-tcms-api@fdd3169f0c97b69eedbfdfeac852e972c57d4c39 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/alekseyvm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fdd3169f0c97b69eedbfdfeac852e972c57d4c39 -
Trigger Event:
release
-
Statement type: