Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable10] Helper methods for deleting app config settings #32451

Merged
merged 1 commit into from
Aug 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions tests/TestHelpers/AppConfigHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,65 @@ public static function modifyServerConfigs(
}
SetupHelper::resetOpcache($baseUrl, $user, $password);
}

/**
* @param string $baseUrl
* @param string $user
* @param string $password
* @param string $app
* @param string $parameter
* @param int $ocsApiVersion (1|2)
*
* @return void
*/
public static function deleteAppConfig(
$baseUrl, $user, $password, $app, $parameter, $ocsApiVersion = 2
) {
$body = [];
$response = OcsApiHelper::sendRequest(
$baseUrl,
$user,
$password,
'delete',
"/apps/testing/api/v1/app/{$app}/{$parameter}",
$body,
$ocsApiVersion
);
PHPUnit_Framework_Assert::assertEquals("200", $response->getStatusCode());
if ($ocsApiVersion === 1) {
PHPUnit_Framework_Assert::assertEquals(
"100", self::getOCSResponse($response)
);
}
}

/**
* @param string $baseUrl
* @param string $user
* @param string $password
* @param array $appParameterValues 'appid' and 'configkey' to delete
* @param int $ocsApiVersion (1|2)
*
* @return void
*/
public static function deleteAppConfigs(
$baseUrl, $user, $password, $appParameterValues, $ocsApiVersion = 2
) {
$body = ['values' => $appParameterValues];
$response = OcsApiHelper::sendRequest(
$baseUrl,
$user,
$password,
'delete',
"/apps/testing/api/v1/apps",
$body,
$ocsApiVersion
);
PHPUnit_Framework_Assert::assertEquals("200", $response->getStatusCode());
if ($ocsApiVersion === 1) {
PHPUnit_Framework_Assert::assertEquals(
"100", self::getOCSResponse($response)
);
}
}
}