0
votes

I'm looking for a codeception configuration to use the Codeception REST Module to make calls against a secured https url.

For example I want to check the online status of our slack bot:

    $slackApiUrl = 'https://slack.com/api/users.getPresence';

    $params = [
        'token' => $apiToken,
        'user' => $botUserId,
    ];

    $I->sendPOST($slackApiUrl, $params);

When I execute the test, I'll get a guzzle error like

[GuzzleHttp\Exception\ConnectException] cURL error 35: SSL: CA certificate set, but certificate verification is disabled (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

I knew, that the default of codeception switch off https secured urls but how can I activate https, when I need it?

My suite.yml:

class_name: AcceptanceTester
modules:
    enabled:
        - REST:
            url: *****
            depends: PhpBrowser
        - PhpBrowser
        - Asserts
        - \Helper\Acceptance
1
Maybe it's important. I'm using Codeception version 2.1.11 - rickroyce

1 Answers

0
votes

I could answer myself. It`s the codeception version. After updating to Codeception v2.2, the same test works like expected.

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