add test to disable in-app notification for File rejected event

Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
prashant-gurung899 committed 2025-01-23 17:06:23 +05:45
1 parent d0ddc61af8
commit 7f458f7047
1 file changed
+215 -167
@@ -30,46 +30,24 @@ Feature: Notification Settings
"type": "object",
"required": ["extension","bundle","setting"],
"properties": {
"extension":{
"const": "ocis-accounts"
},
"bundle":{
"const": "profile"
},
"setting":{
"const": "disable-email-notifications"
}
"extension":{ "const": "ocis-accounts" },
"bundle":{ "const": "profile" },
"setting":{ "const": "disable-email-notifications" }
}
},
"value":{
"type": "object",
"required": [
"id",
"bundleId",
"settingId",
"accountUuid",
"resource"
],
"required": ["id","bundleId","settingId","accountUuid","resource"],
"properties":{
"id":{
"pattern": "%user_id_pattern%"
},
"bundleId":{
"pattern":"%user_id_pattern%"
},
"settingId":{
"pattern":"%user_id_pattern%"
},
"accountUuid":{
"pattern":"%user_id_pattern%"
},
"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"
}
"type":{ "const": "TYPE_USER" }
}
}
}
@@ -106,47 +84,24 @@ Feature: Notification Settings
"type": "object",
"required": ["extension","bundle","setting"],
"properties": {
"extension":{
"const": "ocis-accounts"
},
"bundle":{
"const": "profile"
},
"setting":{
"const": "event-share-created-options"
}
"extension":{ "const": "ocis-accounts" },
"bundle":{ "const": "profile" },
"setting":{ "const": "event-share-created-options" }
}
},
"value":{
"type": "object",
"required": [
"id",
"bundleId",
"settingId",
"accountUuid",
"resource",
"collectionValue"
],
"required": ["id","bundleId","settingId","accountUuid","resource","collectionValue"],
"properties":{
"id":{
"pattern":"%user_id_pattern%"
},
"bundleId":{
"pattern":"%user_id_pattern%"
},
"settingId":{
"pattern":"%user_id_pattern%"
},
"accountUuid":{
"pattern":"%user_id_pattern%"
},
"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"
}
"type":{ "const": "TYPE_USER" }
}
},
"collectionValue":{
@@ -162,32 +117,18 @@ Feature: Notification Settings
"oneOf": [
{
"type": "object",
"required": [
"key",
"boolValue"
],
"required": ["key","boolValue"],
"properties": {
"key":{
"const": "mail"
},
"boolValue":{
"const": false
}
"key":{ "const": "mail" },
"boolValue":{ "const": false }
}
},
{
"type": "object",
"required": [
"key",
"boolValue"
],
"required": ["key","boolValue"],
"properties": {
"key":{
"const": "in-app"
},
"boolValue":{
"const": false
}
"key":{ "const": "in-app" },
"boolValue":{ "const": false }
}
}
]
@@ -238,47 +179,24 @@ Feature: Notification Settings
"type": "object",
"required": ["extension","bundle","setting"],
"properties": {
"extension":{
"const": "ocis-accounts"
},
"bundle":{
"const": "profile"
},
"setting":{
"const": "event-share-removed-options"
}
"extension":{ "const": "ocis-accounts" },
"bundle":{ "const": "profile" },
"setting":{ "const": "event-share-removed-options" }
}
},
"value":{
"type": "object",
"required": [
"id",
"bundleId",
"settingId",
"accountUuid",
"resource",
"collectionValue"
],
"required": ["id","bundleId","settingId","accountUuid","resource","collectionValue"],
"properties":{
"id":{
"pattern":"%user_id_pattern%"
},
"bundleId":{
"pattern":"%user_id_pattern%"
},
"settingId":{
"pattern":"%user_id_pattern%"
},
"accountUuid":{
"pattern":"%user_id_pattern%"
},
"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"
}
"type":{ "const": "TYPE_USER" }
}
},
"collectionValue":{
@@ -294,17 +212,10 @@ Feature: Notification Settings
"oneOf": [
{
"type": "object",
"required": [
"key",
"boolValue"
],
"required": ["key","boolValue"],
"properties": {
"key":{
"const": "in-app"
},
"boolValue":{
"const": false
}
"key":{ "const": "in-app" },
"boolValue":{ "const": false }
}
}
]
@@ -356,47 +267,24 @@ Feature: Notification Settings
"type": "object",
"required": ["extension","bundle","setting"],
"properties": {
"extension":{
"const": "ocis-accounts"
},
"bundle":{
"const": "profile"
},
"setting":{
"const": "event-share-removed-options"
}
"extension":{ "const": "ocis-accounts" },
"bundle":{ "const": "profile" },
"setting":{ "const": "event-share-removed-options" }
}
},
"value":{
"type": "object",
"required": [
"id",
"bundleId",
"settingId",
"accountUuid",
"resource",
"collectionValue"
],
"required": ["id","bundleId","settingId","accountUuid","resource","collectionValue"],
"properties":{
"id":{
"pattern":"%user_id_pattern%"
},
"bundleId":{
"pattern":"%user_id_pattern%"
},
"settingId":{
"pattern":"%user_id_pattern%"
},
"accountUuid":{
"pattern":"%user_id_pattern%"
},
"id":{ "pattern":"%user_id_pattern%" },
"bundleId":{ "pattern":"%user_id_pattern%" },
"settingId":{ "pattern":"%user_id_pattern%" },
"accountUuid":{ "pattern":"%user_id_pattern%" },
"resource":{
"type": "object",
"required":["type"],
"properties": {
"type":{
"const": "TYPE_USER"
}
"type":{ "const": "TYPE_USER" }
}
},
"collectionValue":{
@@ -412,17 +300,10 @@ Feature: Notification Settings
"oneOf": [
{
"type": "object",
"required": [
"key",
"boolValue"
],
"required": ["key","boolValue"],
"properties": {
"key":{
"const": "in-app"
},
"boolValue":{
"const": false
}
"key":{ "const": "in-app" },
"boolValue":{ "const": false }
}
}
]
@@ -444,3 +325,170 @@ Feature: Notification Settings
| message |
| Alice Hansen shared insideSpace.txt with you |
But user "Brian" should not have a notification related to resource "insideSpace.txt" with subject "Resource unshared"
@antivirus
Scenario Outline: disable in-app notification for File rejected event
Given using <dav-path-version> DAV path
When user "Brian" disables notification for the following events using the settings API:
| File rejected | in-app |
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": "event-postprocessing-step-finished-options" }
}
},
"value":{
"type": "object",
"required": ["id","bundleId","settingId","accountUuid","resource","collectionValue"],
"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" }
}
},
"collectionValue":{
"type": "object",
"required":["values"],
"properties": {
"values":{
"type": "array",
"maxItems": 1,
"minItems": 1,
"uniqueItems": true,
"items": {
"oneOf": [
{
"type": "object",
"required": ["key","boolValue"],
"properties": {
"key":{ "const": "in-app" },
"boolValue":{ "const": false }
}
}
]
}
}
}
}
}
}
}
}
}
}
"""
And user "Brian" has uploaded file "filesForUpload/filesWithVirus/<file-name>" to "<new-file-name>"
When user "Brian" lists all notifications
Then the HTTP status code should be "200"
And user "Brian" should not have any notification
Examples:
| dav-path-version | file-name | new-file-name |
| old | eicar.com | virusFile1.txt |
| new | eicar.com | virusFile1.txt |
| spaces | eicar.com | virusFile1.txt |
@antivirus
Scenario: disable in-app notification for File rejected event (Project space)
Given using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "newSpace" with the default quota using the Graph API
And user "Alice" has sent the following space share invitation:
| space | newSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | Space Editor |
When user "Brian" disables notification for the following events using the settings API:
| File rejected | in-app |
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": "event-postprocessing-step-finished-options" }
}
},
"value":{
"type": "object",
"required": ["id","bundleId","settingId","accountUuid","resource","collectionValue"],
"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" }
}
},
"collectionValue":{
"type": "object",
"required":["values"],
"properties": {
"values":{
"type": "array",
"maxItems": 1,
"minItems": 1,
"uniqueItems": true,
"items": {
"oneOf": [
{
"type": "object",
"required": ["key","boolValue"],
"properties": {
"key":{ "const": "in-app" },
"boolValue":{ "const": false }
}
}
]
}
}
}
}
}
}
}
}
}
}
"""
And user "Brian" has uploaded a file "filesForUpload/filesWithVirus/eicar.com" to "virusFile.txt" in space "newSpace"
When user "Brian" lists all notifications
Then the HTTP status code should be "200"
And user "Brian" should get a notification with subject "Space shared" and message:
| message |
| Alice Hansen added you to Space newSpace |
But user "Brian" should not have a notification related to resource "virusFile.txt" with subject "Virus found"