test: disable retry when sync disabled for a share
get default aut-sync setting
This commit is contained in:
@@ -181,8 +181,10 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
if (\array_key_exists($user, $this->autoSyncSettings)) {
|
if (\array_key_exists($user, $this->autoSyncSettings)) {
|
||||||
return $this->autoSyncSettings[$user];
|
return $this->autoSyncSettings[$user];
|
||||||
}
|
}
|
||||||
// auto-sync is enabled by default
|
$autoSyncSetting = $this->settingsContext->getAutoAcceptSharesSettingValue($user);
|
||||||
return true;
|
$this->autoSyncSettings[$user] = $autoSyncSetting;
|
||||||
|
|
||||||
|
return $autoSyncSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1465,15 +1467,12 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
*
|
*
|
||||||
* @param ResponseInterface|null $response
|
* @param ResponseInterface|null $response
|
||||||
*
|
*
|
||||||
* @return object
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getJsonDecodedResponseBodyContent(ResponseInterface $response = null):?object {
|
public function getJsonDecodedResponseBodyContent(ResponseInterface $response = null): mixed {
|
||||||
$response = $response ?? $this->response;
|
$response = $response ?? $this->response;
|
||||||
if ($response !== null) {
|
$response->getBody()->rewind();
|
||||||
$response->getBody()->rewind();
|
return json_decode($response->getBody()->getContents(), null, 512, JSON_THROW_ON_ERROR);
|
||||||
return json_decode($response->getBody()->getContents());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2440,12 +2439,14 @@ class FeatureContext extends BehatVariablesContext {
|
|||||||
$this->ocsContext = new OCSContext();
|
$this->ocsContext = new OCSContext();
|
||||||
$this->authContext = new AuthContext();
|
$this->authContext = new AuthContext();
|
||||||
$this->tusContext = new TUSContext();
|
$this->tusContext = new TUSContext();
|
||||||
|
$this->settingsContext = new SettingsContext();
|
||||||
$this->ocsContext->before($scope);
|
$this->ocsContext->before($scope);
|
||||||
$this->authContext->setUpScenario($scope);
|
$this->authContext->setUpScenario($scope);
|
||||||
$this->tusContext->setUpScenario($scope);
|
$this->tusContext->setUpScenario($scope);
|
||||||
$environment->registerContext($this->ocsContext);
|
$environment->registerContext($this->ocsContext);
|
||||||
$environment->registerContext($this->authContext);
|
$environment->registerContext($this->authContext);
|
||||||
$environment->registerContext($this->tusContext);
|
$environment->registerContext($this->tusContext);
|
||||||
|
$environment->registerContext($this->settingsContext);
|
||||||
$scenarioLine = $scope->getScenario()->getLine();
|
$scenarioLine = $scope->getScenario()->getLine();
|
||||||
$featureFile = $scope->getFeature()->getFile();
|
$featureFile = $scope->getFeature()->getFile();
|
||||||
$suiteName = $scope->getSuite()->getName();
|
$suiteName = $scope->getSuite()->getName();
|
||||||
|
|||||||
@@ -359,6 +359,37 @@ class SettingsContext implements Context {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $user
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @throws GuzzleException
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function getAutoAcceptSharesSettingValue(string $user): bool {
|
||||||
|
$response = $this->sendRequestGetSettingsValuesList($user);
|
||||||
|
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||||
|
201,
|
||||||
|
"Expected response status code should be 201",
|
||||||
|
$response
|
||||||
|
);
|
||||||
|
|
||||||
|
$body = $this->featureContext->getJsonDecodedResponseBodyContent($response);
|
||||||
|
|
||||||
|
if (empty($body)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($body->values as $value) {
|
||||||
|
if ($value->identifier->setting === "auto-accept-shares") {
|
||||||
|
return $value->value->boolValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @When /^user "([^"]*)" lists values-list with headers using the Settings API$/
|
* @When /^user "([^"]*)" lists values-list with headers using the Settings API$/
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1132,6 +1132,8 @@ class SharingNgContext implements Context {
|
|||||||
);
|
);
|
||||||
$this->featureContext->setResponse($response);
|
$this->featureContext->setResponse($response);
|
||||||
$this->featureContext->pushToLastStatusCodesArrays();
|
$this->featureContext->pushToLastStatusCodesArrays();
|
||||||
|
// disable check for client.synchronize
|
||||||
|
$this->featureContext->rememberUserAutoSyncSetting($user, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user