mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 17:23:59 -04:00
test: Extract function to get apps with certain enabled state
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
23a6e7aa4f
commit
8195702b0e
1 changed files with 13 additions and 32 deletions
|
|
@ -803,13 +803,8 @@ trait Provisioning {
|
|||
return $extractedElementsArray;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Given /^app "([^"]*)" is disabled$/
|
||||
* @param string $app
|
||||
*/
|
||||
public function appIsDisabled($app) {
|
||||
$fullUrl = $this->baseUrl . 'v2.php/cloud/apps?filter=disabled';
|
||||
private function getAppsWithFilter($filter) {
|
||||
$fullUrl = $this->baseUrl . 'v2.php/cloud/apps?filter=' . $filter;
|
||||
$client = new Client();
|
||||
$options = [];
|
||||
if ($this->currentUser === 'admin') {
|
||||
|
|
@ -820,7 +815,15 @@ trait Provisioning {
|
|||
];
|
||||
|
||||
$this->response = $client->get($fullUrl, $options);
|
||||
$respondedArray = $this->getArrayOfAppsResponded($this->response);
|
||||
return $this->getArrayOfAppsResponded($this->response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^app "([^"]*)" is disabled$/
|
||||
* @param string $app
|
||||
*/
|
||||
public function appIsDisabled($app) {
|
||||
$respondedArray = $this->getAppsWithFilter('disabled');
|
||||
Assert::assertContains($app, $respondedArray);
|
||||
Assert::assertEquals(200, $this->response->getStatusCode());
|
||||
}
|
||||
|
|
@ -830,18 +833,7 @@ trait Provisioning {
|
|||
* @param string $app
|
||||
*/
|
||||
public function appIsEnabled($app) {
|
||||
$fullUrl = $this->baseUrl . 'v2.php/cloud/apps?filter=enabled';
|
||||
$client = new Client();
|
||||
$options = [];
|
||||
if ($this->currentUser === 'admin') {
|
||||
$options['auth'] = $this->adminUser;
|
||||
}
|
||||
$options['headers'] = [
|
||||
'OCS-APIREQUEST' => 'true',
|
||||
];
|
||||
|
||||
$this->response = $client->get($fullUrl, $options);
|
||||
$respondedArray = $this->getArrayOfAppsResponded($this->response);
|
||||
$respondedArray = $this->getAppsWithFilter('enabled');
|
||||
Assert::assertContains($app, $respondedArray);
|
||||
Assert::assertEquals(200, $this->response->getStatusCode());
|
||||
}
|
||||
|
|
@ -854,18 +846,7 @@ trait Provisioning {
|
|||
* @param string $app
|
||||
*/
|
||||
public function appIsNotEnabled($app) {
|
||||
$fullUrl = $this->baseUrl . 'v2.php/cloud/apps?filter=enabled';
|
||||
$client = new Client();
|
||||
$options = [];
|
||||
if ($this->currentUser === 'admin') {
|
||||
$options['auth'] = $this->adminUser;
|
||||
}
|
||||
$options['headers'] = [
|
||||
'OCS-APIREQUEST' => 'true',
|
||||
];
|
||||
|
||||
$this->response = $client->get($fullUrl, $options);
|
||||
$respondedArray = $this->getArrayOfAppsResponded($this->response);
|
||||
$respondedArray = $this->getAppsWithFilter('enabled');
|
||||
Assert::assertNotContains($app, $respondedArray);
|
||||
Assert::assertEquals(200, $this->response->getStatusCode());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue