1

我使用 tcms-api 调用 TestPlan.filter,一切正常,函数返回测试计划。但是调用 TestPlan.create 失败并出现 xmlrpc.client.ProtocolError:

我已经启用了登录帐户的所有权限,但仍然不知道如何更改服务器配置。

请给我任何提示或建议。谢谢。

【环境】Kiwi版本为6.11。我在 Windows 10 上使用 python 3.6(32 位),并使用 winkerberos 替换 xmlrpc.py 中的 kerberos。我还替换了 ServerProxy' 参数以进行自签名认证,如下所示

self.server = ServerProxy(
    url,
    verbose=VERBOSE,
    allow_none=1,
    context=ssl._create_unverified_context()
)

差异 xmlrpc.py

$ diff original_xmlrpc.py xmlrpc.py
18,19c18,19
< import kerberos
<
---
> import winkerberos as kerberos
> import ssl
106c106
<             transport=self._transport,
---
>             context=ssl._create_unverified_context(),

波纹管是测试代码。

#!/usr/bin/env python

import sys
import tcms_api
import datetime
import csv

MANAGER = 'your-username-here'
PRODUCT_ID = 31       # Kiwi TCMS
PRODUCT_VERSION = 721 # 6.1-ee
CATEGORY_ID = 46      # --default--
PRIORITY_ID = 10      # P1

rpc_client = tcms_api.TCMS().exec

NOW = datetime.datetime.now().isoformat().replace('T',' ')[:19]

test_plan = rpc_client.TestPlan.create({
    'name': 'Performance baseline TP at %s' % NOW,
    'text': 'A script is creating this TP and adds TCs and TRs to it to eastablish a performance baseline',
    'type': 7,
    'product': PRIORITY_ID,
    'product_version': PRODUCT_VERSION,
    'is_active': True,
})

下面是输出。

Traceback (most recent call last):
  File "D:\MyWork\MyProject\MyWorkspace\KiwiImporter\kiwi_importer\kiwi_importer.py", line 25, in <module>
    'is_active': True,
  File "C:\Users\AlinHuang\AppData\Local\Programs\Python\Python36-32\lib\xmlrpc\client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "C:\Users\AlinHuang\AppData\Local\Programs\Python\Python36-32\lib\xmlrpc\client.py", line 1452, in __request
    verbose=self.__verbose
  File "C:\Users\AlinHuang\AppData\Local\Programs\Python\Python36-32\lib\xmlrpc\client.py", line 1154, in request
    return self.single_request(host, handler, request_body, verbose)
  File "C:\Users\AlinHuang\AppData\Local\Programs\Python\Python36-32\lib\xmlrpc\client.py", line 1187, in single_request
    dict(resp.getheaders())
xmlrpc.client.ProtocolError: <ProtocolError for 10.39.100.11/xml-rpc/: 403 Forbidden>
4

1 回答 1

1

终于想通了!这是一个错误!

我最近添加了集成测试,这些测试清楚地显示了同样的失败。你可以在这里监控进度https://github.com/kiwitcms/tcms-api/issues/22

很可能有 2 个错误 - 一个在 API 客户端,一个在服务器端。

于 2020-03-20T21:12:36.140 回答