update the scenarios for service availability check
This commit is contained in:
@@ -205,9 +205,14 @@ class AuthContext implements Context {
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userRequestsEndpointsWithNoAuthentication(string $method, TableNode $table):void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint']);
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['endpoint'], ['service']);
|
||||
foreach ($table->getHash() as $row) {
|
||||
$this->featureContext->setResponse($this->sendRequest($row['endpoint'], $method));
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendRequest(
|
||||
$this->featureContext->substituteInLineCodes($row['endpoint']),
|
||||
$method
|
||||
)
|
||||
);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -735,15 +735,9 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function removePortFromUrl(string $url): string {
|
||||
return \str_replace(':9200', '', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOcPath(): string {
|
||||
return $this->ocPath;
|
||||
public function removeSchemeAndPortFromUrl(string $url): string {
|
||||
$parsedUrl = parse_url($url);
|
||||
return $parsedUrl["host"];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -806,8 +800,17 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBaseUrlWithoutSchemeAndPort(): string {
|
||||
return $this->removePortFromUrl($this->removeSchemeFromUrl($this->getBaseUrl()));
|
||||
public function getBaseUrlHostName(): string {
|
||||
return $this->removeSchemeAndPortFromUrl($this->getBaseUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the base URL but without "http(s)://" and port
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCollaborationHostName(): string {
|
||||
return $this->removeSchemeAndPortFromUrl(OcisHelper::getCollaborationServiceUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2206,10 +2209,18 @@ class FeatureContext extends BehatVariablesContext {
|
||||
"parameter" => []
|
||||
],
|
||||
[
|
||||
"code" => "%base_url_without_scheme_and_port%",
|
||||
"code" => "%base_url_hostname%",
|
||||
"function" => [
|
||||
$this,
|
||||
"getBaseUrlWithoutSchemeAndPort"
|
||||
"getBaseUrlHostName"
|
||||
],
|
||||
"parameter" => []
|
||||
],
|
||||
[
|
||||
"code" => "%collaboration_hostname%",
|
||||
"function" => [
|
||||
$this,
|
||||
"getCollaborationHostName"
|
||||
],
|
||||
"parameter" => []
|
||||
],
|
||||
@@ -2995,26 +3006,4 @@ class FeatureContext extends BehatVariablesContext {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @When a user requests these endpoints:
|
||||
*
|
||||
* @param TableNode $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userRequestsEndpoints(TableNode $table): void {
|
||||
$this->verifyTableNodeColumns($table, ['endpoint'], ['service', 'comment']);
|
||||
|
||||
foreach ($table->getHash() as $row) {
|
||||
$this->setResponse(
|
||||
HttpRequestHelper::sendRequest(
|
||||
$this->substituteInLineCodes($row['endpoint']),
|
||||
$this->getStepLineRef()
|
||||
)
|
||||
);
|
||||
$this->pushToLastStatusCodesArrays();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user