Skip to content

Commit

Permalink
Add acceptance test to list local storages using occ command
Browse files Browse the repository at this point in the history
  • Loading branch information
jasson99 committed Jan 16, 2020
1 parent cd44413 commit 225575c
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 @@ -364,6 +364,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 @@ -1119,6 +1129,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 225575c

Please sign in to comment.