Skip to content

Commit 9013b4e

Browse files
authored
Merge pull request #11010 from owncloud/test/test-for-flaky-share-expire-step
[tests-only][full-ci] Test for share expiration grouped emails
2 parents da515e4 + 5c9924c commit 9013b4e

File tree

3 files changed

+88
-6
lines changed

3 files changed

+88
-6
lines changed

tests/acceptance/bootstrap/SharingNgContext.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,23 @@ public function getPermissionsList(
183183
);
184184
}
185185

186+
/**
187+
* @Given /^user "([^"]*)" has triggered the share expiration notification for (?:folder|file) "([^"]*)"$/
188+
*
189+
* @param string $user
190+
* @param string $resource
191+
*
192+
* @return void
193+
* @throws GuzzleException
194+
*/
195+
public function userHasTriggeredTheShareExpirationNotificationForResource(
196+
string $user,
197+
string $resource,
198+
): void {
199+
$response = $this->getPermissionsList($user, "Personal", $resource);
200+
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
201+
}
202+
186203
/**
187204
* @When /^user "([^"]*)" gets permissions list for (?:folder|file) "([^"]*)" of the space "([^"]*)" using the Graph API$/
188205
*

tests/acceptance/bootstrap/SpacesContext.php

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,6 +2724,19 @@ public function userExpiresTheLastShareOfResourceInsideOfTheSpace(
27242724
string $resource,
27252725
string $spaceName,
27262726
): void {
2727+
$response = $this->expireResourceShare($user, $resource, $spaceName);
2728+
$this->featureContext->setResponse($response);
2729+
}
2730+
2731+
/**
2732+
* @param string $user
2733+
* @param string $resource
2734+
* @param string $spaceName
2735+
*
2736+
* @return ResponseInterface
2737+
* @throws GuzzleException|JsonException
2738+
*/
2739+
public function expireResourceShare(string $user, string $resource, string $spaceName): ResponseInterface {
27272740
$rows['expireDate'] = $this->featureContext->formatExpiryDateTime('Y-m-d\\TH:i:sP');
27282741
if ($this->featureContext->isUsingSharingNG()) {
27292742
$space = $this->getSpaceByName($user, $spaceName);
@@ -2743,11 +2756,29 @@ public function userExpiresTheLastShareOfResourceInsideOfTheSpace(
27432756
if ($response->getStatusCode() === 200) {
27442757
$this->featureContext->shareNgAddToCreatedUserGroupShares($response, $resource, $spaceName);
27452758
}
2746-
$this->featureContext->setResponse($response);
2747-
} else {
2748-
$rows['permissions'] = (string)$this->featureContext->getLastCreatedUserGroupShare()->permissions;
2749-
$this->featureContext->setResponse($this->updateSharedResource($user, $rows));
2759+
return $response;
27502760
}
2761+
$rows['permissions'] = (string)$this->featureContext->getLastCreatedUserGroupShare()->permissions;
2762+
return $this->updateSharedResource($user, $rows);
2763+
}
2764+
2765+
/**
2766+
* @Given user :user has expired the last share of resource :resource inside of the space :spaceName
2767+
*
2768+
* @param string $user
2769+
* @param string $resource
2770+
* @param string $spaceName
2771+
*
2772+
* @return void
2773+
* @throws GuzzleException|JsonException
2774+
*/
2775+
public function userHasExpiredTheLastShareOfResourceInsideOfTheSpace(
2776+
string $user,
2777+
string $resource,
2778+
string $spaceName,
2779+
): void {
2780+
$response = $this->expireResourceShare($user, $resource, $spaceName);
2781+
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
27512782
}
27522783

27532784
/**

tests/acceptance/features/cliCommands/emailNotification.feature

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Feature: get grouped email notification
1616
And user "Alice" has created a space "New-Space" with the default quota using the Graph API
1717
And user "Alice" has uploaded file with content "some data" to "lorem.txt"
1818

19-
19+
@issue-11690
2020
Scenario: get daily grouped email notification
2121
Given user "Brian" has set the email sending interval to "daily" using the settings API
2222
And user "Alice" has sent the following resource share invitation:
@@ -26,6 +26,15 @@ Feature: get grouped email notification
2626
| shareType | user |
2727
| permissionsRole | Viewer |
2828
And user "Alice" has removed the access of user "Brian" from resource "lorem.txt" of space "Personal"
29+
And user "Alice" has sent the following resource share invitation:
30+
| resource | lorem.txt |
31+
| space | Personal |
32+
| sharee | Brian |
33+
| shareType | user |
34+
| permissionsRole | Viewer |
35+
| expirationDateTime | 2042-01-01T23:59:59.000Z |
36+
And user "Alice" has expired the last share of resource "lorem.txt" inside of the space "Personal"
37+
And user "Alice" has triggered the share expiration notification for file "lorem.txt"
2938
And user "Alice" has sent the following space share invitation:
3039
| space | New-Space |
3140
| sharee | Brian |
@@ -54,6 +63,14 @@ Feature: get grouped email notification
5463
Even though this share has been revoked you still might have access through other shares and/or space memberships.
5564
5665
66+
Alice Hansen has shared "lorem.txt" with you.
67+
68+
69+
Your share to lorem.txt has expired at %expiry_date_in_mail%
70+
71+
Even though this share has been revoked you still might have access through other shares and/or space memberships.
72+
73+
5774
Alice Hansen has invited you to join "New-Space".
5875
5976
@@ -70,7 +87,7 @@ Feature: get grouped email notification
7087
Even though this membership has expired you still might have access through other shares and/or space memberships
7188
"""
7289

73-
90+
@issue-11690
7491
Scenario: get weekly grouped email notification
7592
Given user "Brian" has set the email sending interval to "weekly" using the settings API
7693
And user "Alice" has sent the following resource share invitation:
@@ -80,6 +97,15 @@ Feature: get grouped email notification
8097
| shareType | user |
8198
| permissionsRole | Viewer |
8299
And user "Alice" has removed the access of user "Brian" from resource "lorem.txt" of space "Personal"
100+
And user "Alice" has sent the following resource share invitation:
101+
| resource | lorem.txt |
102+
| space | Personal |
103+
| sharee | Brian |
104+
| shareType | user |
105+
| permissionsRole | Viewer |
106+
| expirationDateTime | 2042-01-01T23:59:59.000Z |
107+
And user "Alice" has expired the last share of resource "lorem.txt" inside of the space "Personal"
108+
And user "Alice" has triggered the share expiration notification for file "lorem.txt"
83109
And user "Alice" has sent the following space share invitation:
84110
| space | New-Space |
85111
| sharee | Brian |
@@ -108,6 +134,14 @@ Feature: get grouped email notification
108134
Even though this share has been revoked you still might have access through other shares and/or space memberships.
109135
110136
137+
Alice Hansen has shared "lorem.txt" with you.
138+
139+
140+
Your share to lorem.txt has expired at %expiry_date_in_mail%
141+
142+
Even though this share has been revoked you still might have access through other shares and/or space memberships.
143+
144+
111145
Alice Hansen has invited you to join "New-Space".
112146
113147

0 commit comments

Comments
 (0)