Skip to content

Commit

Permalink
Merge pull request #698 from iamsauravsharma/delete-restore-file-folder
Browse files Browse the repository at this point in the history
test delete and restore of file and folder using API is visible in activity list
  • Loading branch information
individual-it authored Feb 8, 2019
2 parents bf3a3a7 + 8cbac6e commit b226102
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/acceptance/config/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ default:
- '%paths.base%/../features/apiActivity'
contexts:
- ActivityContext:
- TrashbinContext:
- FeatureContext: *common_feature_context_params
198 changes: 198 additions & 0 deletions tests/acceptance/features/apiActivity/list.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,204 @@ Feature: List activity
| typeicon | /^icon-delete-color$/ |
| subject_prepared | /^You deleted <file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/&scrollto=textfile0\.txt\.d\d+&view=trashbin\" id=\"\d+\">textfile0\.txt<\/file>$/ |

Scenario: file restore should be listed in the activity list
Given user "user0" has been created with default attributes
And user "user0" has deleted file "textfile0.txt"
And user "user0" has logged in to a web-style session
When user "user0" restores the file with original path "textfile0.txt" using the trashbin API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_restored$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^restored_self$/ |
| object_name | /^\/textfile0.txt$/ |
| object_type | /^files$/ |
| subject_prepared | /^You restored <file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/&scrollto=textfile0\.txt\" id=\"\d+\">textfile0\.txt<\/file>$/ |

Scenario: folder deletion should be listed in the activity list
Given user "user0" has been created with default attributes
When user "user0" deletes folder "FOLDER" using the WebDAV API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_deleted$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^deleted_self$/ |
| object_name | /^\/FOLDER$/ |
| object_type | /^files$/ |
| typeicon | /^icon-delete-color$/ |
| subject_prepared | /^You deleted <file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/FOLDER\.d\d+&view=trashbin\" id=\"\d+\">FOLDER<\/file>$/ |

Scenario: folder restore should be listed in the activity list
Given user "user0" has been created with default attributes
And user "user0" has deleted folder "FOLDER"
And user "user0" has logged in to a web-style session
When user "user0" restores the folder with original path "FOLDER" using the trashbin API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_restored$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^restored_self$/ |
| object_name | /^\/FOLDER$/ |
| object_type | /^files$/ |
| subject_prepared | /^You restored <file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/FOLDER\" id=\"\d+\">FOLDER<\/file>$/ |

Scenario: file inside folder deletion should be listed in the activity list
Given user "user0" has been created with default attributes
When user "user0" deletes file "PARENT/parent.txt" using the WebDAV API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_deleted$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^deleted_self$/ |
| object_name | /^\/PARENT\/parent.txt$/ |
| object_type | /^files$/ |
| typeicon | /^icon-delete-color$/ |
| subject_prepared | /^You deleted <file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/&scrollto=parent\.txt\.d\d+&view=trashbin\" id=\"\d+\">PARENT\/parent.txt<\/file>$/ |

Scenario: file inside folder restore should be listed in the activity list
Given user "user0" has been created with default attributes
And user "user0" has deleted file "PARENT/parent.txt"
And user "user0" has logged in to a web-style session
When user "user0" restores the file with original path "PARENT/parent.txt" using the trashbin API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_restored$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^restored_self$/ |
| object_name | /^\/PARENT\/parent.txt$/ |
| object_type | /^files$/ |
| subject_prepared | /^You restored <file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/PARENT&scrollto=parent\.txt\" id=\"\d+\">PARENT\/parent\.txt<\/file>$/ |

Scenario: sub folder deletion should be listed in the activity list
Given user "user0" has been created with default attributes
When user "user0" deletes folder "PARENT/CHILD" using the WebDAV API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_deleted$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^deleted_self$/ |
| object_name | /^\/PARENT\/CHILD$/ |
| object_type | /^files$/ |
| typeicon | /^icon-delete-color$/ |
| subject_prepared | /^You deleted <file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/CHILD.d\d+&view=trashbin\" id=\"\d+\">PARENT\/CHILD<\/file>$/ |

Scenario: sub folder restore should be listed in the activity list
Given user "user0" has been created with default attributes
And user "user0" has deleted folder "PARENT/CHILD"
And user "user0" has logged in to a web-style session
When user "user0" restores the folder with original path "PARENT/CHILD" using the trashbin API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_restored$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^restored_self$/ |
| object_name | /^\/PARENT\/CHILD$/ |
| object_type | /^files$/ |
| subject_prepared | /^You restored <file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/PARENT\/CHILD" id=\"\d+\">PARENT\/CHILD<\/file>$/ |

Scenario: multiple file deletion should be listed in activity list
Given user "user0" has been created with default attributes
When user "user0" deletes file "textfile0.txt" using the WebDAV API
And user "user0" deletes file "textfile1.txt" using the WebDAV API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_deleted$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^deleted_self$/ |
| object_name | /^\/textfile1\.txt$/ |
| object_type | /^files$/ |
| typeicon | /^icon-delete-color$/ |
| subject_prepared | /^You deleted <collection><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/&scrollto=textfile1\.txt\.d\d+&view=trashbin\" id=\"\d+\">textfile1\.txt<\/file><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/&scrollto=textfile0\.txt\.d\d+&view=trashbin\" id=\"\d+\">textfile0\.txt<\/file><\/collection>$/ |

Scenario: multiple folder deletion should be listed in activity list
Given user "user0" has been created with default attributes
When user "user0" deletes folder "PARENT" using the WebDAV API
And user "user0" deletes folder "FOLDER" using the WebDAV API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_deleted$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^deleted_self$/ |
| object_name | /^\/FOLDER$/ |
| object_type | /^files$/ |
| typeicon | /^icon-delete-color$/ |
| subject_prepared | /^You deleted <collection><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/FOLDER\.d\d+&view=trashbin\" id=\"\d+\">FOLDER<\/file><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/PARENT\.d\d+&view=trashbin\" id=\"\d+\">PARENT<\/file><\/collection>$/ |

Scenario: multiple file restore should be listed in activity list
Given user "user0" has been created with default attributes
And user "user0" has deleted file "textfile0.txt"
And user "user0" has deleted file "textfile1.txt"
And user "user0" has logged in to a web-style session
When user "user0" restores the file with original path "textfile0.txt" using the trashbin API
And user "user0" restores the file with original path "textfile1.txt" using the trashbin API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_restored$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^restored_self$/ |
| object_name | /^\/textfile1\.txt$/ |
| object_type | /^files$/ |
| subject_prepared | /^You restored <collection><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/&scrollto=textfile1\.txt\" id=\"\d+\">textfile1\.txt<\/file><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/&scrollto=textfile0\.txt\" id=\"\d+\">textfile0\.txt<\/file><\/collection>$/ |

Scenario: multiple folder restore should be listed in activity list
Given user "user0" has been created with default attributes
And user "user0" has deleted folder "FOLDER"
And user "user0" has deleted folder "PARENT"
And user "user0" has logged in to a web-style session
When user "user0" restores the folder with original path "FOLDER" using the trashbin API
And user "user0" restores the folder with original path "PARENT" using the trashbin API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_restored$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^restored_self$/ |
| object_name | /^\/PARENT$/ |
| object_type | /^files$/ |
| subject_prepared | /^You restored <collection><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/PARENT\" id=\"\d+\">PARENT<\/file><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/FOLDER\" id=\"\d+\">FOLDER<\/file><\/collection>$/ |

Scenario: mix of folder and file deletion should be listed in activity list
Given user "user0" has been created with default attributes
When user "user0" deletes file "textfile0.txt" using the WebDAV API
And user "user0" deletes folder "FOLDER" using the WebDAV API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_deleted$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^deleted_self$/ |
| object_name | /^\/FOLDER$/ |
| object_type | /^files$/ |
| typeicon | /^icon-delete-color$/ |
| subject_prepared | /^You deleted <collection><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/FOLDER\.d\d+&view=trashbin\" id=\"\d+\">FOLDER<\/file><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/&scrollto=textfile0\.txt\.d\d+&view=trashbin\" id=\"\d+\">textfile0\.txt<\/file><\/collection>$/ |

Scenario: mix of folder and file restore should be listed in activity list
Given user "user0" has been created with default attributes
And user "user0" has deleted file "textfile0.txt"
And user "user0" has deleted folder "FOLDER"
And user "user0" has logged in to a web-style session
When user "user0" restores the file with original path "textfile0.txt" using the trashbin API
And user "user0" restores the folder with original path "FOLDER" using the trashbin API
Then the activity number 1 of user "user0" should match these properties:
| type | /^file_restored$/ |
| user | /^user0$/ |
| affecteduser | /^user0$/ |
| app | /^files$/ |
| subject | /^restored_self$/ |
| object_name | /^\/FOLDER$/ |
| object_type | /^files$/ |
| subject_prepared | /^You restored <collection><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/FOLDER\" id=\"\d+\">FOLDER<\/file><file link=\"%base_url%\/(index\.php\/)?apps\/files\/\?dir=\/&scrollto=textfile0\.txt\" id=\"\d+\">textfile0\.txt<\/file><\/collection>$/ |

Scenario: folder share should be listed in the activity list
Given these users have been created with default attributes but not initialized:
| username |
Expand Down

0 comments on commit b226102

Please sign in to comment.