Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sharetype keys that are human readable instead of number #2071

Merged
merged 1 commit into from
Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/acceptance/helpers/sharingHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ const fetch = require('node-fetch')
const assert = require('assert')

module.exports = {
PERMISSION_TYPES: {
SHARE_TYPES: Object.freeze({
user: 0,
group: 1,
public_link: 3,
federated_cloud_share: 6
}),
PERMISSION_TYPES: Object.freeze({
read: 1,
change: 2,
create: 4,
delete: 8,
share: 16,
all: 31
},
SHARE_TYPES: {
user: 0,
group: 1,
public_link: 3,
federated_cloud_share: 6
},
}),
/**
*
* @param permissionsString string of permissions separated by comma. For valid permissions see this.PERMISSION_TYPES
Expand Down
7 changes: 4 additions & 3 deletions tests/acceptance/stepDefinitions/sharingContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require('url-search-params-polyfill')
const httpHelper = require('../helpers/httpHelper')
const userSettings = require('../helpers/userSettings')
const sharingHelper = require('../helpers/sharingHelper')
const { SHARE_TYPES } = require('../helpers/sharingHelper')

/**
*
Expand Down Expand Up @@ -53,7 +54,7 @@ const userSharesFileOrFolderWithGroup = function (file, sharee, role) {
* @param {number} shareType Type of share 0 = user, 1 = group, 3 = public (link), 6 = federated (cloud share).
* @param {string} permissions permissions of the share for valid permissions see sharingHelper.PERMISSION_TYPES
*/
const shareFileFolder = function (elementToShare, sharer, receiver, shareType = 0, permissionString = 'all') {
const shareFileFolder = function (elementToShare, sharer, receiver, shareType = SHARE_TYPES.user, permissionString = 'all') {
const permissions = sharingHelper.humanReadablePermissionsToBitmask(permissionString)
const params = new URLSearchParams()
params.append('shareType', shareType)
Expand Down Expand Up @@ -140,12 +141,12 @@ Given('the user has shared file/folder {string} with user {string}', function (s
Given(
'user {string} has shared file/folder {string} with user {string} with {string} permissions',
function (sharer, elementToShare, receiver, permissions) {
return shareFileFolder(elementToShare, sharer, receiver, 0, permissions)
return shareFileFolder(elementToShare, sharer, receiver, SHARE_TYPES.user, permissions)
}
)

Given('user {string} has shared file/folder {string} with group {string}', function (sharer, elementToShare, receiver) {
return shareFileFolder(elementToShare, sharer, receiver, 1)
return shareFileFolder(elementToShare, sharer, receiver, SHARE_TYPES.group)
})

When('the user types {string} in the share-with-field', function (input) {
Expand Down