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)) {
|
||||
return $this->autoSyncSettings[$user];
|
||||
}
|
||||
// auto-sync is enabled by default
|
||||
return true;
|
||||
$autoSyncSetting = $this->settingsContext->getAutoAcceptSharesSettingValue($user);
|
||||
$this->autoSyncSettings[$user] = $autoSyncSetting;
|
||||
|
||||
return $autoSyncSetting;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1465,15 +1467,12 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*
|
||||
* @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;
|
||||
if ($response !== null) {
|
||||
$response->getBody()->rewind();
|
||||
return json_decode($response->getBody()->getContents());
|
||||
}
|
||||
return null;
|
||||
$response->getBody()->rewind();
|
||||
return json_decode($response->getBody()->getContents(), null, 512, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2440,12 +2439,14 @@ class FeatureContext extends BehatVariablesContext {
|
||||
$this->ocsContext = new OCSContext();
|
||||
$this->authContext = new AuthContext();
|
||||
$this->tusContext = new TUSContext();
|
||||
$this->settingsContext = new SettingsContext();
|
||||
$this->ocsContext->before($scope);
|
||||
$this->authContext->setUpScenario($scope);
|
||||
$this->tusContext->setUpScenario($scope);
|
||||
$environment->registerContext($this->ocsContext);
|
||||
$environment->registerContext($this->authContext);
|
||||
$environment->registerContext($this->tusContext);
|
||||
$environment->registerContext($this->settingsContext);
|
||||
$scenarioLine = $scope->getScenario()->getLine();
|
||||
$featureFile = $scope->getFeature()->getFile();
|
||||
$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$/
|
||||
*
|
||||
|
||||
@@ -1132,6 +1132,8 @@ class SharingNgContext implements Context {
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
// disable check for client.synchronize
|
||||
$this->featureContext->rememberUserAutoSyncSetting($user, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user