Skip to content

Commit 2b5b2af

Browse files
committed
Merge branch 'MQE-651' into develop
2 parents 058d21f + 05bdd26 commit 2b5b2af

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

src/Magento/FunctionalTestingFramework/DataGenerator/Persist/Curl/WebapiExecutor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function __construct($storeCode = 'default')
7070
*
7171
* @return void
7272
*/
73-
private function authorize()
73+
protected function authorize()
7474
{
7575
$authUrl = parent::$baseUrl . 'rest/' . $this->storeCode . self::ADMIN_AUTH_URL;
7676
$authCreds = [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\FunctionalTestingFramework\DataGenerator\Persist\Curl;
8+
9+
/**
10+
* Curl executor for Magento Web Api requests that do not require authorization.
11+
*/
12+
class WebapiNoAuthExecutor extends WebapiExecutor
13+
{
14+
/**
15+
* No authorization is needed and just return.
16+
*
17+
* @return void
18+
*/
19+
protected function authorize()
20+
{
21+
//NOP
22+
}
23+
}

src/Magento/FunctionalTestingFramework/DataGenerator/Persist/CurlHandler.php

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\FunctionalTestingFramework\DataGenerator\Persist\Curl\AdminExecutor;
99
use Magento\FunctionalTestingFramework\DataGenerator\Persist\Curl\FrontendExecutor;
1010
use Magento\FunctionalTestingFramework\DataGenerator\Persist\Curl\WebapiExecutor;
11+
use Magento\FunctionalTestingFramework\DataGenerator\Persist\Curl\WebapiNoAuthExecutor;
1112
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\OperationDefinitionObjectHandler;
1213
use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
1314
use Magento\FunctionalTestingFramework\DataGenerator\Objects\OperationDefinitionObject;
@@ -136,6 +137,9 @@ public function executeRequest($dependentEntities)
136137
$this->requestData['customer_email'],
137138
$this->requestData['customer_password']
138139
);
140+
} elseif ($authorization === 'anonymous') {
141+
$this->isJson = true;
142+
$executor = new WebapiNoAuthExecutor($this->storeCode);
139143
}
140144

141145
if (!$executor) {

src/Magento/FunctionalTestingFramework/DataGenerator/Persist/DataPersistenceHandler.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,10 @@ private function setCreatedObject($response, $index, $requestDataArray, $isJson)
184184
if (is_array($responseData)) {
185185
$persistedData = $this->convertToFlatArray(array_merge($requestDataArray, $responseData));
186186
} else {
187-
$persistedData = $requestDataArray;
187+
$persistedData = $this->convertToFlatArray(array_merge($requestDataArray, ['return' => $responseData]));
188188
}
189189
} else {
190-
$persistedData = array_merge(
191-
$this->convertToFlatArray($requestDataArray),
192-
['return' => $response]
193-
);
190+
$persistedData = array_merge($this->convertToFlatArray($requestDataArray), ['return' => $response]);
194191
}
195192

196193
$this->createdObject = new EntityDataObject(

src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
<xs:enumeration value="adminOauth" />
8989
<xs:enumeration value="adminFormKey" />
9090
<xs:enumeration value="customerFormKey" />
91+
<xs:enumeration value="anonymous" />
9192
</xs:restriction>
9293
</xs:simpleType>
9394
</xs:schema>

0 commit comments

Comments
 (0)