Skip to content

Commit

Permalink
Merge pull request #32451 from owncloud/stable10-app-config-helper
Browse files Browse the repository at this point in the history
[stable10] Helper methods for deleting app config settings
  • Loading branch information
phil-davis authored Aug 27, 2018
2 parents 29b6ad6 + 2adf024 commit cd2550c
Showing 1 changed file with 61 additions and 0 deletions.
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)
);
}
}
}

0 comments on commit cd2550c

Please sign in to comment.