From 24b8893d7a1684e5c7d0eed22ab2107ef27ec08c Mon Sep 17 00:00:00 2001 From: prashant-gurung899 Date: Mon, 27 Jan 2025 09:54:26 +0545 Subject: [PATCH] add test to enable receiving email intervals to never Signed-off-by: prashant-gurung899 --- .../acceptance/bootstrap/SettingsContext.php | 24 ++++++++ .../apiSettings/notificationSetting.feature | 57 +++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/tests/acceptance/bootstrap/SettingsContext.php b/tests/acceptance/bootstrap/SettingsContext.php index e043e726c01..b9ce785734b 100644 --- a/tests/acceptance/bootstrap/SettingsContext.php +++ b/tests/acceptance/bootstrap/SettingsContext.php @@ -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); + } } diff --git a/tests/acceptance/features/apiSettings/notificationSetting.feature b/tests/acceptance/features/apiSettings/notificationSetting.feature index 1335054144d..ad0ca159c04 100644 --- a/tests/acceptance/features/apiSettings/notificationSetting.feature +++ b/tests/acceptance/features/apiSettings/notificationSetting.feature @@ -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