Skip to content

Commit bac6cad

Browse files
committed
add some integration tests
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
1 parent b30e40f commit bac6cad

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

build/integration/features/bootstrap/FederationContext.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
class FederationContext implements Context, SnippetAcceptingContext {
3636

3737
use WebDav;
38+
use AppConfiguration;
3839

3940
/**
4041
* @Given /^User "([^"]*)" from server "(LOCAL|REMOTE)" shares "([^"]*)" with user "([^"]*)" from server "(LOCAL|REMOTE)"$/
@@ -56,6 +57,27 @@ public function federateSharing($sharerUser, $sharerServer, $sharerPath, $sharee
5657
$this->usingServer($previous);
5758
}
5859

60+
61+
/**
62+
* @Given /^User "([^"]*)" from server "(LOCAL|REMOTE)" shares "([^"]*)" with group "([^"]*)" from server "(LOCAL|REMOTE)"$/
63+
*
64+
* @param string $sharerUser
65+
* @param string $sharerServer "LOCAL" or "REMOTE"
66+
* @param string $sharerPath
67+
* @param string $shareeUser
68+
* @param string $shareeServer "LOCAL" or "REMOTE"
69+
*/
70+
public function federateGroupSharing($sharerUser, $sharerServer, $sharerPath, $shareeGroup, $shareeServer){
71+
if ($shareeServer == "REMOTE"){
72+
$shareWith = "$shareeGroup@" . substr($this->remoteBaseUrl, 0, -4);
73+
} else {
74+
$shareWith = "$shareeGroup@" . substr($this->localBaseUrl, 0, -4);
75+
}
76+
$previous = $this->usingServer($sharerServer);
77+
$this->createShare($sharerUser, $sharerPath, 9, $shareWith, null, null, null);
78+
$this->usingServer($previous);
79+
}
80+
5981
/**
6082
* @When /^User "([^"]*)" from server "(LOCAL|REMOTE)" accepts last pending share$/
6183
* @param string $user
@@ -73,4 +95,9 @@ public function acceptLastPendingShare($user, $server){
7395
$this->theOCSStatusCodeShouldBe('100');
7496
$this->usingServer($previous);
7597
}
98+
99+
protected function resetAppConfigs() {
100+
$this->modifyServerConfig('files_sharing', 'incoming_server2server_group_share_enabled', 'no');
101+
$this->modifyServerConfig('files_sharing', 'outgoing_server2server_group_share_enabled', 'no');
102+
}
76103
}

build/integration/federation_features/federated.feature

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,39 @@ Feature: federated
2828
| share_with | user1@REMOTE |
2929
| share_with_displayname | user1@REMOTE |
3030

31+
Scenario: Federated group share a file with another server
32+
Given Using server "REMOTE"
33+
And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
34+
And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
35+
And user "gs-user1" exists
36+
And user "gs-user2" exists
37+
And group "group1" exists
38+
And check that user "gs-user1" belongs to group "group1"
39+
And check that user "gs-user2" belongs to group "group1"
40+
And Using server "LOCAL"
41+
And user "gs-user0" exists
42+
When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE"
43+
Then the OCS status code should be "100"
44+
And the HTTP status code should be "200"
45+
And Share fields of last share match with
46+
| id | A_NUMBER |
47+
| item_type | file |
48+
| item_source | A_NUMBER |
49+
| share_type | 9 |
50+
| file_source | A_NUMBER |
51+
| path | /textfile0.txt |
52+
| permissions | 19 |
53+
| stime | A_NUMBER |
54+
| storage | A_NUMBER |
55+
| mail_send | 0 |
56+
| uid_owner | gs-user0 |
57+
| storage_id | home::gs-user0 |
58+
| file_parent | A_NUMBER |
59+
| displayname_owner | gs-user0 |
60+
| share_with | group1@REMOTE |
61+
| share_with_displayname | group1@REMOTE |
62+
63+
3164
Scenario: Federate share a file with local server
3265
Given Using server "LOCAL"
3366
And user "user0" exists

0 commit comments

Comments
 (0)