diff --git a/.drone.star b/.drone.star index a93145542..7bdd5b353 100644 --- a/.drone.star +++ b/.drone.star @@ -90,6 +90,7 @@ config = { "apiSharingNgShareInvitation", "apiSharingNgLinkSharePermission", "apiSharingNgLinkShareRoot", + "apiActivities", ], "skip": False, }, diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index 040aaf541..a587cc247 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -391,6 +391,15 @@ default: - SpacesContext: - OcisConfigContext: + apiActivities: + paths: + - "%paths.base%/../features/apiActivities" + context: *common_ldap_suite_context + contexts: + - FeatureContext: *common_feature_context_params + - SharingNgContext: + - GraphContext: + cliCommands: paths: - "%paths.base%/../features/cliCommands" diff --git a/tests/acceptance/features/apiActivities/shareActivities.feature b/tests/acceptance/features/apiActivities/shareActivities.feature new file mode 100644 index 000000000..b468b729b --- /dev/null +++ b/tests/acceptance/features/apiActivities/shareActivities.feature @@ -0,0 +1,269 @@ +Feature: check share activity + As a user + I want to check who shared which file to whom + So that I can track activities of a file + + Background: + Given these users have been created with default attributes and without skeleton files: + | username | + | Alice | + | Brian | + And user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt" + + + Scenario: check activities after adding share to a file + Given user "Alice" has sent the following resource share invitation: + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Alice" lists the activities for file "textfile.txt" of space "Personal" using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {space}" + } + } + } + } + }, + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} shared {resource} with {sharee}" + }, + "variables": { + "type": "object", + "required": ["resource","sharee","user"], + "properties": { + "resource": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "textfile.txt" + } + } + }, + "sharee": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "const": "Brian" + } + } + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + }, + "displayName": { + "const": "Alice" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """ + + + Scenario: check activities after removing share from a file + Given user "Alice" has sent the following resource share invitation: + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + And user "Alice" has removed the access of user "Brian" from resource "textfile.txt" of space "Personal" + When user "Alice" lists the activities for file "textfile.txt" of space "Personal" using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 3, + "maxItems": 3, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {space}" + } + } + } + } + }, + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} shared {resource} with {sharee}" + } + } + } + } + }, + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} removed {sharee} from {resource}" + }, + "variables": { + "type": "object", + "required": ["resource","sharee","user"], + "properties": { + "resource": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "%file_id_pattern%" + }, + "name": { + "const": "textfile.txt" + } + } + }, + "sharee": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + }, + "displayName": { + "const": "Brian" + } + } + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + }, + "displayName": { + "const": "Alice" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """