Skip to content

Commit 5c9924c

Browse files
committed
test: update step for resource expiration
1 parent 77a0315 commit 5c9924c

File tree

3 files changed

+64
-8
lines changed

3 files changed

+64
-8
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: 12 additions & 4 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:
@@ -34,6 +34,7 @@ Feature: get grouped email notification
3434
| permissionsRole | Viewer |
3535
| expirationDateTime | 2042-01-01T23:59:59.000Z |
3636
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"
3738
And user "Alice" has sent the following space share invitation:
3839
| space | New-Space |
3940
| sharee | Brian |
@@ -62,7 +63,10 @@ Feature: get grouped email notification
6263
Even though this share has been revoked you still might have access through other shares and/or space memberships.
6364
6465
65-
Your share to "lorem.txt" has expired at %expiry_date_in_mail%
66+
Alice Hansen has shared "lorem.txt" with you.
67+
68+
69+
Your share to lorem.txt has expired at %expiry_date_in_mail%
6670
6771
Even though this share has been revoked you still might have access through other shares and/or space memberships.
6872
@@ -83,7 +87,7 @@ Feature: get grouped email notification
8387
Even though this membership has expired you still might have access through other shares and/or space memberships
8488
"""
8589

86-
90+
@issue-11690
8791
Scenario: get weekly grouped email notification
8892
Given user "Brian" has set the email sending interval to "weekly" using the settings API
8993
And user "Alice" has sent the following resource share invitation:
@@ -101,6 +105,7 @@ Feature: get grouped email notification
101105
| permissionsRole | Viewer |
102106
| expirationDateTime | 2042-01-01T23:59:59.000Z |
103107
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"
104109
And user "Alice" has sent the following space share invitation:
105110
| space | New-Space |
106111
| sharee | Brian |
@@ -129,7 +134,10 @@ Feature: get grouped email notification
129134
Even though this share has been revoked you still might have access through other shares and/or space memberships.
130135
131136
132-
Your share to "lorem.txt" has expired at %expiry_date_in_mail%
137+
Alice Hansen has shared "lorem.txt" with you.
138+
139+
140+
Your share to lorem.txt has expired at %expiry_date_in_mail%
133141
134142
Even though this share has been revoked you still might have access through other shares and/or space memberships.
135143

0 commit comments

Comments
 (0)