Skip to content

Commit

Permalink
Merge pull request #10928 from owncloud/test/email-intervals
Browse files Browse the repository at this point in the history
[tests-only][full-ci] add test to set receiving email intervals to never
  • Loading branch information
prashant-gurung899 authored Feb 6, 2025
2 parents 5bb0951 + 24b8893 commit 6339a71
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/acceptance/bootstrap/SettingsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,4 +642,28 @@ public function userDisablesNotificationForFollowingEventUsingSettingsApi(
$this->featureContext->setResponse($response);
}
}

/**
* @When /^user "([^"]*)" sets the email sending interval to "([^"]*)" using the settings API$/
*
* @param string $user
* @param string $interval
*
* @return void
*/
public function userSetsTheEmailSendingIntervalToUsingTheSettingsAPI(
string $user,
string $interval,
): void {
$body = $this->getBodyForNotificationSetting($user, "Email sending interval");
$body["value"]["stringValue"] = $interval;
$response = SettingsHelper::updateSettings(
$this->featureContext->getBaseUrl(),
$this->featureContext->getActualUsername($user),
$this->featureContext->getPasswordForUser($user),
json_encode($body),
$this->featureContext->getStepLineRef(),
);
$this->featureContext->setResponse($response);
}
}
57 changes: 57 additions & 0 deletions tests/acceptance/features/apiSettings/notificationSetting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -758,3 +758,60 @@ Feature: Notification Settings
Then the HTTP status code should be "200"
And the notifications should be empty
And user "Brian" should have "0" emails


Scenario: no email should be received when email sending interval is set to never
When user "Brian" sets the email sending interval to "never" using the settings API
Then the HTTP status code should be "201"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["value"],
"properties": {
"value": {
"type": "object",
"required": ["identifier","value"],
"properties": {
"identifier":{
"type": "object",
"required": ["extension","bundle","setting"],
"properties": {
"extension":{ "const": "ocis-accounts" },
"bundle":{ "const": "profile" },
"setting":{ "const": "email-sending-interval-options" }
}
},
"value":{
"type": "object",
"required": ["id","bundleId","settingId","accountUuid","resource","stringValue"],
"properties":{
"id":{ "pattern":"%uuidv4_pattern%" },
"bundleId":{ "pattern":"%uuidv4_pattern%" },
"settingId":{ "pattern":"%uuidv4_pattern%" },
"accountUuid":{ "pattern":"%uuidv4_pattern%" },
"resource":{
"type": "object",
"required":["type"],
"properties": {
"type":{ "const": "TYPE_USER" }
}
},
"stringValue":{ "const":"never" }
}
}
}
}
}
}
"""
When user "Alice" sends the following resource share invitation using the Graph API:
| resource | lorem.txt |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
Then user "Brian" should get a notification with subject "Resource shared" and message:
| message |
| Alice Hansen shared lorem.txt with you |
And user "Brian" should have "0" emails

0 comments on commit 6339a71

Please sign in to comment.