Skip to content

Commit 3ca7d66

Browse files
committed
MAGETWO-64626: Web API test for file export
edit test for run on http
1 parent f21f966 commit 3ca7d66

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

dev/tests/api-functional/testsuite/Magento/Analytics/Api/LinkProviderTest.php

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Analytics\Api;
77

88
use Magento\Framework\UrlInterface;
9+
use Magento\Framework\Webapi\Rest\Request;
910
use Magento\TestFramework\TestCase\WebapiAbstract;
1011

1112
/**
@@ -47,15 +48,28 @@ public function testGetAll()
4748

4849
$serviceInfo = [
4950
'rest' => [
50-
'resourcePath' => self::RESOURCE_PATH,
51-
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET,
51+
'resourcePath' => static::RESOURCE_PATH,
52+
'httpMethod' => Request::HTTP_METHOD_GET,
5253
],
5354
'soap' => [
54-
'service' => self::SERVICE_NAME,
55+
'service' => static::SERVICE_NAME,
5556
'serviceVersion' => self::SERVICE_VERSION,
56-
'operation' => self::SERVICE_NAME . 'Get',
57+
'operation' => static::SERVICE_NAME . 'Get',
5758
],
5859
];
60+
if (!$this->isTestBaseUrlSecure()) {
61+
try {
62+
$this->_webApiCall($serviceInfo);
63+
} catch (\Exception $e) {
64+
$this->assertEquals(
65+
'{"message":"Operation allowed only in HTTPS"}',
66+
$e->getMessage()
67+
);
68+
return;
69+
}
70+
$this->fail("Exception 'Operation allowed only in HTTPS' should be thrown");
71+
}
72+
5973
$response = $this->_webApiCall($serviceInfo);
6074
$this->assertEquals(2, count($response));
6175
$this->assertEquals(base64_encode($fileInfo->getInitializationVector()), $response['initialization_vector']);
@@ -66,4 +80,12 @@ public function testGetAll()
6680
$response['url']
6781
);
6882
}
83+
84+
/**
85+
* @return bool
86+
*/
87+
private function isTestBaseUrlSecure()
88+
{
89+
return strpos('https://', TESTS_BASE_URL) !== false;
90+
}
6991
}

0 commit comments

Comments
 (0)