Skip to content

Commit

Permalink
Merge pull request #36754 from owncloud/listLocalStorage
Browse files Browse the repository at this point in the history
[Tests-only] Add acceptance test to list all created local storage using occ command
  • Loading branch information
phil-davis authored Jan 16, 2020
2 parents 4bf22e5 + fa7f881 commit e5666c8
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/acceptance/features/bootstrap/OccContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,16 @@ public function deleteLastBackgroundJobUsingTheOccCommand($job) {
$this->lastDeletedJobId = $match;
}

/**
* List created local storage mount
*
* @return void
* @throws Exception
*/
public function listLocalStorageMount() {
$this->invokingTheCommand('files_external:list --output=json');
}

/**
* @When the administrator enables DAV tech_preview
*
Expand Down Expand Up @@ -1165,6 +1175,35 @@ public function theAdminHasAddedRemovedTheApplicableUserForMountUsingTheOccComma
$this->theCommandShouldHaveBeenSuccessful();
}

/**
* @When the administrator lists the local storage using the occ command
*
* @return void
* @throws Exception
*/
public function userListsLocalStorageMountUsingTheOccCommand() {
$this->listLocalStorageMount();
}

/**
* @Then the following local storage should exist
*
* @param TableNode $mountPoints
*
* @return void
*/
public function theFollowingLocalStoragesShouldExist(TableNode $mountPoints) {
$createdLocalStorage = [];
$expectedLocalStorages = $mountPoints->getColumnsHash();
$commandOutput = \json_decode($this->featureContext->getStdOutOfOccCommand());
foreach ($commandOutput as $storageEntry) {
$createdLocalStorage[$storageEntry->mount_id] = \ltrim($storageEntry->mount_point, '/');
}
foreach ($expectedLocalStorages as $expectedStorageEntry) {
Assert::assertContains($expectedStorageEntry['localStorage'], $createdLocalStorage);
}
}

/**
* @When the administrator list the repair steps using the occ command
*
Expand Down
16 changes: 16 additions & 0 deletions tests/acceptance/features/cliLocalStorage/listLocalStorage.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@cli @skipOnLDAP @local_storage
Feature: create local storage from the command line
As an admin
I want to list all created local storage from the command line
So that I can view available local storage

Scenario: List the created local storage
Given the administrator has created the local storage mount "local_storage2"
And the administrator has created the local storage mount "new_local_storage"
And the administrator has uploaded file with content "this is a file in local storage" to "/local_storage2/file-in-local-storage.txt"
And the administrator has uploaded file with content "new file" to "/new_local_storage/new-file"
When the administrator lists the local storage using the occ command
Then the following local storage should exist
| localStorage |
| local_storage2 |
| new_local_storage |

0 comments on commit e5666c8

Please sign in to comment.