From 3a93b440070d63b6d14c217e4f214dad31d31e42 Mon Sep 17 00:00:00 2001 From: Sagar Gurung <46086950+SagarGi@users.noreply.github.com> Date: Wed, 24 May 2023 10:39:40 +0545 Subject: [PATCH] [tests-only][full-ci]Added GDPR export for folder creation, sharing a file (#6360) * Added GDPR export for folder creation, sharing a file * Added link creation GDPR scenario * Added scenarios for GDPR export for item trashed event * Review addresss --- .../features/apiGraph/userGDPRExport.feature | 333 ++++++++++++++++++ 1 file changed, 333 insertions(+) diff --git a/tests/acceptance/features/apiGraph/userGDPRExport.feature b/tests/acceptance/features/apiGraph/userGDPRExport.feature index 354e45cc744..5ea571273d1 100644 --- a/tests/acceptance/features/apiGraph/userGDPRExport.feature +++ b/tests/acceptance/features/apiGraph/userGDPRExport.feature @@ -518,3 +518,336 @@ Feature: user GDPR (General Data Protection Regulation) report | Admin | User | | Admin | Guest | | Admin | Admin | + + + Scenario: generate a GDPR report and check events when user creates a folder + Given user "Alice" has created folder "/folderMain" + When user "Alice" exports her GDPR report to "/.personal_data_export.json" using the Graph API + And user "Alice" downloads the content of GDPR report ".personal_data_export.json" + Then the HTTP status code of responses on each endpoint should be "201, 200" respectively + And the downloaded JSON content should contain event type "events.ContainerCreated" in item 'events' and should match + """ + { + "type": "object", + "required": [ + "event" + ], + "properties": { + "event" : { + "type": "object", + "required": [ + "Executant", + "Owner", + "Ref", + "SpaceOwner" + ], + "properties": { + "Executant": { + "type": "object", + "required": [ + "idp", + "opaque_id", + "type" + ], + "properties": { + "idp": { + "type": "string", + "pattern": "^%base_url%$" + }, + "opaque_id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "type": { + "type": "number", + "enum": [1] + } + } + }, + "Ref": { + "type": "object", + "required": [ + "path", + "resource_id" + ], + "properties": { + "path" : { + "type": "string", + "enum": ["./folderMain"] + } + } + } + } + } + } + } + """ + + + Scenario: generate a GDPR report and check events when a user shares a folder + Given user "Brian" has been created with default attributes and without skeleton files + And user "Alice" has created folder "/folderMain" + And user "Alice" has shared entry "/folderMain" with user "Brian" + When user "Alice" exports her GDPR report to "/.personal_data_export.json" using the Graph API + And user "Alice" downloads the content of GDPR report ".personal_data_export.json" + Then the HTTP status code of responses on each endpoint should be "201, 200" respectively + And the downloaded JSON content should contain event type "events.ShareCreated" in item 'events' and should match + """ + { + "type": "object", + "required": [ + "event" + ], + "properties": { + "event" : { + "type": "object", + "required": [ + "CTime", + "Executant", + "GranteeGroupID", + "GranteeUserID", + "ItemID", + "Permissions", + "ShareID", + "Sharee", + "Sharer" + ], + "properties": { + "GranteeGroupID": { + "type": ["number", "null"], + "enum": [null] + }, + "Permissions": { + "type": "object", + "required": [ + "permissions" + ], + "properties": { + "permissions": { + "type": "object", + "required": [ + "add_grant", + "get_path", + "get_quota", + "initiate_file_download", + "list_container", + "list_recycle", + "stat" + ], + "properties": { + "add_grant" : { + "type": "boolean", + "enum": [true] + }, + "get_path" : { + "type": "boolean", + "enum": [true] + }, + "get_quota" : { + "type": "boolean", + "enum": [true] + }, + "initiate_file_download" : { + "type": "boolean", + "enum": [true] + }, + "list_container" : { + "type": "boolean", + "enum": [true] + }, + "list_recycle" : { + "type": "boolean", + "enum": [true] + }, + "stat" : { + "type": "boolean", + "enum": [true] + } + } + } + } + }, + "ShareID": { + "type": "object", + "required": [ + "opaque_id" + ], + "properties": { + "type": "object", + "pattern": "^%user_id_pattern%:%user_id_pattern%:%user_id_pattern%$" + } + }, + "Sharee": { + "type": ["number", "null"], + "enum": [null] + }, + "Sharer": { + "type": "object", + "required": [ + "idp", + "opaque_id", + "type" + ], + "properties": { + "idp": { + "type": "string", + "pattern": "^%base_url%$" + }, + "opaque_id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "type": { + "type": "number", + "enum": [1] + } + } + } + } + } + } + } + """ + + + Scenario: generate a GDPR report and check events when a user creates a public link share + Given user "Brian" has been created with default attributes and without skeleton files + And user "Alice" has created folder "/folderMain" + And user "Alice" has created a public link share with settings + | path | /folderMain | + | name | sharedlink | + When user "Alice" exports her GDPR report to "/.personal_data_export.json" using the Graph API + And user "Alice" downloads the content of GDPR report ".personal_data_export.json" + Then the HTTP status code of responses on each endpoint should be "201, 200" respectively + And the downloaded JSON content should contain event type "events.LinkCreated" in item 'events' and should match + """ + { + "type": "object", + "required": [ + "event" + ], + "properties": { + "event" : { + "type": "object", + "required": [ + "CTime", + "DisplayName", + "Executant", + "Expiration", + "ItemID", + "PasswordProtected", + "Permissions", + "ShareID", + "Sharer", + "Token" + ], + "properties": { + "DisplayName": { + "type": "string", + "enum": ["sharedlink"] + }, + "Expiration": { + "type": ["string", "null"], + "enum": [null] + }, + "PasswordProtected": { + "type": "boolean", + "enum": [false] + }, + "Permissions": { + "type": "object", + "required": [ + "permissions" + ], + "properties": { + "permissions": { + "type": "object", + "required": [ + "get_path", + "get_quota", + "initiate_file_download", + "list_container", + "list_recycle", + "stat" + ], + "properties": { + "get_path" : { + "type": "boolean", + "enum": [true] + }, + "get_quota" : { + "type": "boolean", + "enum": [true] + }, + "initiate_file_download" : { + "type": "boolean", + "enum": [true] + }, + "list_container" : { + "type": "boolean", + "enum": [true] + }, + "list_recycle" : { + "type": "boolean", + "enum": [true] + }, + "stat" : { + "type": "boolean", + "enum": [true] + } + } + } + } + }, + "Token": { + "type": "string", + "pattern": "^[a-zA-Z]{15}$" + } + } + } + } + } + """ + + + Scenario: generate a GDPR report and check events when user deletes a resource + Given user "Alice" has created folder "/folderMain" + And user "Alice" has deleted folder "/folderMain" + When user "Alice" exports her GDPR report to "/.personal_data_export.json" using the Graph API + And user "Alice" downloads the content of GDPR report ".personal_data_export.json" + Then the HTTP status code of responses on each endpoint should be "201, 200" respectively + And the downloaded JSON content should contain event type "events.ItemTrashed" in item 'events' and should match + """ + { + "type": "object", + "required": [ + "event" + ], + "properties": { + "event" : { + "type": "object", + "required": [ + "Executant", + "Owner", + "ID", + "Ref", + "SpaceOwner" + ], + "properties": { + "Ref": { + "type": "object", + "required": [ + "path" + ], + "properties": { + "path" : { + "type": "string", + "enum": ["./folderMain"] + } + } + } + } + } + } + } + """