我正在寻找一个代码配置配置来使用Codeception REST模块对安全的https网址进行调用。
例如,我想查看我们的slack bot的在线状态:
$slackApiUrl = 'https://slack.com/api/users.getPresence';
$params = [
'token' => $apiToken,
'user' => $botUserId,
];
$I->sendPOST($slackApiUrl, $params);
当我执行测试时,我会得到像
这样的guzzle错误[GuzzleHttp \ Exception \ ConnectException] cURL错误35:SSL:CA证书集,但证书验证已禁用(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html)
我知道,代码的默认设置会关闭https安全网址,但如何在需要时激活https?
我的suite.yml
:
class_name: AcceptanceTester
modules:
enabled:
- REST:
url: *****
depends: PhpBrowser
- PhpBrowser
- Asserts
- \Helper\Acceptance
答案 0 :(得分:0)
我可以自己回答。它是代码版本。在更新到Codeception v2.2之后,相同的测试工作与预期的一样。
Codeception PHP Testing Framework v2.2.8
Powered by PHPUnit 5.7.15 by Sebastian Bergmann and contributors.
[Groups] slack
Acceptance (live) Tests (1) --------------------------------------------------------------------------
Modules: REST, PhpBrowser, Asserts, \Helper\Acceptance
------------------------------------------------------------------------------------------------------
slackCest: Check slack bot online status
I send post "https://slack.com/api/users.getPresence"
[...]
[Response] {"ok":true,"presence":"active"}
I am going to Check SlackBot online status
I see response contains json {"ok":true,"presence":"active"}
PASSED