Skip to content

Commit 42239fc

Browse files
committed
Test for transfer ownership with incoming shares
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
1 parent 249582a commit 42239fc

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

build/integration/features/bootstrap/CommandLineContext.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private function findLastTransferFolderForUser($sourceUser, $targetUser) {
9797
}
9898

9999
/**
100-
* @When /^transferring ownership from "([^"]+)" to "([^"]+)"/
100+
* @When /^transferring ownership from "([^"]+)" to "([^"]+)"$/
101101
*/
102102
public function transferringOwnership($user1, $user2) {
103103
if ($this->runOcc(['files:transfer-ownership', $user1, $user2]) === 0) {
@@ -109,7 +109,7 @@ public function transferringOwnership($user1, $user2) {
109109
}
110110

111111
/**
112-
* @When /^transferring ownership of path "([^"]+)" from "([^"]+)" to "([^"]+)"/
112+
* @When /^transferring ownership of path "([^"]+)" from "([^"]+)" to "([^"]+)"$/
113113
*/
114114
public function transferringOwnershipPath($path, $user1, $user2) {
115115
$path = '--path=' . $path;
@@ -121,6 +121,18 @@ public function transferringOwnershipPath($path, $user1, $user2) {
121121
}
122122
}
123123

124+
/**
125+
* @When /^transferring ownership of path "([^"]+)" from "([^"]+)" to "([^"]+)" with received shares$/
126+
*/
127+
public function transferringOwnershipPathWithIncomingShares($path, $user1, $user2) {
128+
$path = '--path=' . $path;
129+
if ($this->runOcc(['files:transfer-ownership', $path, $user1, $user2, '--transfer-incoming-shares=1']) === 0) {
130+
$this->lastTransferPath = $this->findLastTransferFolderForUser($user1, $user2);
131+
} else {
132+
// failure
133+
$this->lastTransferPath = null;
134+
}
135+
}
124136

125137
/**
126138
* @When /^using received transfer folder of "([^"]+)" as dav path$/

build/integration/features/transfer-ownership.feature

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,35 @@ Feature: transfer-ownership
533533
And Getting info of last share
534534
And the OCS status code should be "404"
535535

536+
Scenario: transferring ownership transfers received shares into subdir when requested
537+
Given user "user0" exists
538+
And user "user1" exists
539+
And user "user2" exists
540+
And User "user2" created a folder "/transfer-share"
541+
And User "user2" created a folder "/do-not-transfer"
542+
And User "user0" created a folder "/sub"
543+
And folder "/transfer-share" of user "user2" is shared with user "user0" with permissions 31
544+
And user "user0" accepts last share
545+
And User "user0" moved folder "/transfer-share" to "/sub/transfer-share"
546+
And folder "/do-not-transfer" of user "user2" is shared with user "user0" with permissions 31
547+
And user "user0" accepts last share
548+
When transferring ownership of path "sub" from "user0" to "user1" with received shares
549+
And the command was successful
550+
And As an "user1"
551+
And using received transfer folder of "user1" as dav path
552+
Then as "user1" the folder "/sub" exists
553+
And as "user1" the folder "/do-not-transfer" does not exist
554+
And as "user1" the folder "/sub/do-not-transfer" does not exist
555+
And as "user1" the folder "/sub/transfer-share" exists
556+
And using old dav path
557+
And as "user1" the folder "/transfer-share" does not exist
558+
And as "user1" the folder "/do-not-transfer" does not exist
559+
And using old dav path
560+
And as "user0" the folder "/sub" does not exist
561+
And as "user0" the folder "/do-not-transfer" exists
562+
And Getting info of last share
563+
And the OCS status code should be "404"
564+
536565
Scenario: transferring ownership does not transfer external storage
537566
Given user "user0" exists
538567
And user "user1" exists

0 commit comments

Comments
 (0)