Skip to content

Commit a48c222

Browse files
committed
MAGETWO-39322: REST tests are failed on mainline
-changed httpClient from StreamClient to CurlClient - added wrapper on CurlClient - fixed tests
1 parent 24bd117 commit a48c222

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\TestFramework\Authentication\Rest;
7+
8+
use OAuth\Common\Http\Uri\UriInterface;
9+
10+
/**
11+
* Custom Client implementation for cURL
12+
*/
13+
class CurlClient extends \OAuth\Common\Http\Client\CurlClient
14+
{
15+
/**
16+
* {@inheritdoc}
17+
*/
18+
public function retrieveResponse(
19+
UriInterface $endpoint,
20+
$requestBody,
21+
array $extraHeaders = [],
22+
$method = 'POST'
23+
) {
24+
$this->setCurlParameters([CURLOPT_FAILONERROR => true]);
25+
return parent::retrieveResponse($endpoint, $requestBody, $extraHeaders, $method);
26+
}
27+
}

Diff for: dev/tests/api-functional/framework/Magento/TestFramework/Authentication/Rest/OauthClient.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(
4040
UriInterface $baseApiUri = null
4141
) {
4242
if (!isset($httpClient)) {
43-
$httpClient = new \OAuth\Common\Http\Client\CurlClient();
43+
$httpClient = new \Magento\TestFramework\Authentication\Rest\CurlClient();
4444
$httpClient->setTimeout(self::DEFAULT_TIMEOUT);
4545
}
4646
if (!isset($storage)) {

Diff for: dev/tests/api-functional/testsuite/Magento/Webapi/Authentication/RestTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function testGetRequestToken()
8585

8686
/**
8787
* @expectedException \Exception
88-
* @expectedExceptionMessage HTTP/1.1 401
88+
* @expectedExceptionMessage 401 Unauthorized
8989
*/
9090
public function testGetRequestTokenExpiredConsumer()
9191
{
@@ -97,7 +97,7 @@ public function testGetRequestTokenExpiredConsumer()
9797

9898
/**
9999
* @expectedException \Exception
100-
* @expectedExceptionMessage HTTP/1.1 401
100+
* @expectedExceptionMessage 401 Unauthorized
101101
*/
102102
public function testGetRequestTokenInvalidConsumerKey()
103103
{
@@ -107,7 +107,7 @@ public function testGetRequestTokenInvalidConsumerKey()
107107

108108
/**
109109
* @expectedException \Exception
110-
* @expectedExceptionMessage HTTP/1.1 401
110+
* @expectedExceptionMessage 401 Unauthorized
111111
*/
112112
public function testGetRequestTokenInvalidConsumerSecret()
113113
{
@@ -141,7 +141,7 @@ public function testGetAccessToken()
141141

142142
/**
143143
* @expectedException \Exception
144-
* @expectedExceptionMessage HTTP/1.1 401
144+
* @expectedExceptionMessage 401 Unauthorized
145145
*/
146146
public function testGetAccessTokenInvalidVerifier()
147147
{
@@ -156,7 +156,7 @@ public function testGetAccessTokenInvalidVerifier()
156156

157157
/**
158158
* @expectedException \Exception
159-
* @expectedExceptionMessage HTTP/1.1 401
159+
* @expectedExceptionMessage 401 Unauthorized
160160
*/
161161
public function testGetAccessTokenConsumerMismatch()
162162
{
@@ -176,7 +176,7 @@ public function testGetAccessTokenConsumerMismatch()
176176

177177
/**
178178
* @expectedException \Exception
179-
* @expectedExceptionMessage HTTP/1.1 400
179+
* @expectedExceptionMessage 400 Bad Request
180180
*/
181181
public function testAccessApiInvalidAccessToken()
182182
{

0 commit comments

Comments
 (0)