Merge pull request #1206 from nextcloud/stable9.1-integration_tests_local_external_storage

[Stable10] integration tests local external storage
This commit is contained in:
Roeland Jago Douma 2016-08-31 13:54:24 +02:00 committed by GitHub
commit e39cf78c52
6 changed files with 91 additions and 6 deletions

View File

@ -334,5 +334,29 @@ trait BasicStructure {
rmdir("../../core/skeleton/PARENT");
}
}
/**
* @BeforeScenario @local_storage
*/
public static function removeFilesFromLocalStorageBefore(){
$dir = "./work/local_storage/";
$di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
foreach ( $ri as $file ) {
$file->isDir() ? rmdir($file) : unlink($file);
}
}
/**
* @AfterScenario @local_storage
*/
public static function removeFilesFromLocalStorageAfter(){
$dir = "./work/local_storage/";
$di = new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
foreach ( $ri as $file ) {
$file->isDir() ? rmdir($file) : unlink($file);
}
}
}

View File

@ -0,0 +1,26 @@
Feature: external-storage
Background:
Given using api version "1"
Given using dav path "remote.php/webdav"
@local_storage
Scenario: Share by link a file inside a local external storage
Given user "user0" exists
And user "user1" exists
And As an "user0"
And user "user0" created a folder "/local_storage/foo"
And User "user0" moved file "/textfile0.txt" to "/local_storage/foo/textfile0.txt"
And folder "/local_storage/foo" of user "user0" is shared with user "user1"
And As an "user1"
When creating a share with
| path | foo |
| shareType | 3 |
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And Share fields of last share match with
| id | A_NUMBER |
| url | AN_URL |
| token | A_TOKEN |
| mimetype | httpd/unix-directory |

View File

@ -295,6 +295,7 @@ Feature: provisioning
| theming |
| updatenotification |
| workflowengine |
| files_external |
Scenario: get app info
Given As an "admin"
@ -304,19 +305,19 @@ Feature: provisioning
Scenario: enable an app
Given As an "admin"
And app "files_external" is disabled
When sending "POST" to "/cloud/apps/files_external"
And app "testing" is disabled
When sending "POST" to "/cloud/apps/testing"
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And app "files_external" is enabled
And app "testing" is enabled
Scenario: disable an app
Given As an "admin"
And app "files_external" is enabled
When sending "DELETE" to "/cloud/apps/files_external"
And app "testing" is enabled
When sending "DELETE" to "/cloud/apps/testing"
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And app "files_external" is disabled
And app "testing" is disabled
Scenario: disable an user
Given As an "admin"

View File

@ -41,6 +41,21 @@ Feature: sharing
Then the OCS status code should be "100"
And the HTTP status code should be "200"
Scenario: Creating a new share with user who already received a share through their group
Given As an "admin"
And user "user0" exists
And user "user1" exists
And group "sharing-group" exists
And user "user1" belongs to group "sharing-group"
And file "welcome.txt" of user "user0" is shared with group "sharing-group"
And As an "user0"
Then sending "POST" to "/apps/files_sharing/api/v1/shares" with
| path | welcome.txt |
| shareWith | user1 |
| shareType | 0 |
Then the OCS status code should be "100"
And the HTTP status code should be "200"
Scenario: Creating a new public share
Given user "user0" exists
And As an "user0"

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -36,12 +36,27 @@ echo $PHPPID_FED
export TEST_SERVER_URL="http://localhost:$PORT/ocs/"
export TEST_SERVER_FED_URL="http://localhost:$PORT_FED/ocs/"
#Enable external storage app
../../occ app:enable files_external
mkdir -p work/local_storage
OUTPUT_CREATE_STORAGE=`../../occ files_external:create local_storage local null::null -c datadir=./build/integration/work/local_storage`
ID_STORAGE=`echo $OUTPUT_CREATE_STORAGE | awk {'print $5'}`
../../occ files_external:option $ID_STORAGE enable_sharing true
vendor/bin/behat -f junit -f pretty $SCENARIO_TO_RUN
RESULT=$?
kill $PHPPID
kill $PHPPID_FED
../../occ files_external:delete -y $ID_STORAGE
#Disable external storage app
../../occ app:disable files_external
if [ -z $HIDE_OC_LOGS ]; then
tail "../../data/nextcloud.log"
fi