Skip to content

Commit

Permalink
Added acceptance test for enforced expiration date on a user share
Browse files Browse the repository at this point in the history
  • Loading branch information
kiranparajuli589 committed Mar 6, 2020
1 parent 804ef17 commit 1217f90
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -605,3 +605,20 @@ Feature: Sharing files and folders with internal users
| uid_owner | user1 |
| share_with | user2 |
| expiration | +7 |

Scenario Outline: enforced expiration date on collaborators share
Given the setting "shareapi_default_expire_date" of app "core" has been set to "yes"
And the setting "shareapi_expire_after_n_days" of app "core" has been set to "42"
And user "user1" has logged in using the webUI
When the user shares file "<shared-resource>" with user "User Two" using the webUI
Then user "user1" should have a share with these details:
| field | value |
| path | /<shared-resource> |
| share_type | user |
| uid_owner | user1 |
| share_with | user2 |
| expiration | null |
Examples:
| shared-resource |
| lorem.txt |
| simple-folder |
15 changes: 11 additions & 4 deletions tests/acceptance/helpers/sharingHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,17 @@ module.exports = {
} else if (expectedDetail.field === 'expiration') {
expectedDetail.value = sharingHelper.calculateDate(expectedDetail.value)
}

if (!(expectedDetail.field in share) || share[expectedDetail.field].toString() !== expectedDetail.value) {
found = false
break
if (share[expectedDetail.field] === null) {
// assertion for null values
if (!(expectedDetail.field in share) || expectedDetail.value !== 'null') {
found = false
break
}
} else {
if (!(expectedDetail.field in share) || share[expectedDetail.field].toString() !== expectedDetail.value) {
found = false
break
}
}
}
if (found) {
Expand Down

0 comments on commit 1217f90

Please sign in to comment.