From c910bb18088c61c6a034dca9f932b2f4fff23670 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 | 4 ++ .../apiSettings/notificationSetting.feature | 60 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/tests/acceptance/bootstrap/SettingsContext.php b/tests/acceptance/bootstrap/SettingsContext.php index e043e726c01..09352bd548c 100644 --- a/tests/acceptance/bootstrap/SettingsContext.php +++ b/tests/acceptance/bootstrap/SettingsContext.php @@ -632,6 +632,10 @@ public function userDisablesNotificationForFollowingEventUsingSettingsApi( $body["value"]["collectionValue"]["values"][] = ["key" => "in-app","boolValue" => $enableOrDisable === "enables"]; } + if (str_contains($value, "never")) { + $body["value"]["stringValue"] + = "never"; + } $response = SettingsHelper::updateSettings( $this->featureContext->getBaseUrl(), $this->featureContext->getActualUsername($user), diff --git a/tests/acceptance/features/apiSettings/notificationSetting.feature b/tests/acceptance/features/apiSettings/notificationSetting.feature index 6d7a077a313..b7833ef7793 100644 --- a/tests/acceptance/features/apiSettings/notificationSetting.feature +++ b/tests/acceptance/features/apiSettings/notificationSetting.feature @@ -607,3 +607,63 @@ Feature: Notification Settings | message | | Alice Hansen added you to Space new-space | But user "Brian" should not have a notification related to space "new-space" with subject "Space disabled" + + + Scenario: no email should be received when email sending interval is set to never + When user "Brian" enables notification for the following events using the settings API: + | Email sending interval | never | + 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" } + } + } + } + } + } + } + """ + And user "Alice" has sent the following resource share invitation: + | resource | lorem.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Brian" lists all notifications + Then the HTTP status code should be "200" + And 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