Skip to content
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
ocis doen't create link share without password
Browse files Browse the repository at this point in the history
  • Loading branch information
saw-jan committed Nov 30, 2023
1 parent 047145d commit b027f5e
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 11 deletions.
9 changes: 9 additions & 0 deletions tests/providerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ describe('provider testing', () => {
},
'resource is shared': (setup, parameters) => {
if (setup) {
if (isRunningWithOCIS() && !parameters.password) {
return
}
const { username, ...shareParams } = parameters
const response = shareResource(username, shareParams)
const { status } = getOCSMeta(response)
Expand All @@ -258,6 +261,9 @@ describe('provider testing', () => {
},
'folder exists in last shared public share': (setup, parameters) => {
if (setup) {
if (isRunningWithOCIS() && !parameters.password) {
return
}
const { folderName, password } = parameters
const response = createFolderInLastPublicShare(lastSharedToken, folderName, password)

Expand All @@ -271,6 +277,9 @@ describe('provider testing', () => {
},
'file exists in last shared public share': (setup, parameters) => {
if (setup) {
if (isRunningWithOCIS() && !parameters.password) {
return
}
const {
fileName,
password,
Expand Down
59 changes: 48 additions & 11 deletions tests/publicLinkTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,21 @@ describe('oc.publicFiles', function () {
},
'with password': {
shareParams: {
password: 'password'
password: 'Pwd:1234'
},
passwordWhenListing: 'password',
passwordWhenListing: 'Pwd:1234',
shallGrantAccess: true
},
'with password but invalid when accessing': {
shareParams: {
password: 'password'
password: 'Pwd:1234'
},
passwordWhenListing: 'invalid',
shallGrantAccess: false
},
'with password but no password when accessing': {
shareParams: {
password: 'password'
password: 'Pwd:1234'
},
passwordWhenListing: null,
shallGrantAccess: false
Expand Down Expand Up @@ -362,6 +362,9 @@ describe('oc.publicFiles', function () {
let provider
if (data.shallGrantAccess) {
provider = createProvider()
if (!data.shareParams.password) {
provider = createProvider(false, true)
}
} else {
provider = createProvider(false, true)
}
Expand Down Expand Up @@ -411,14 +414,19 @@ describe('oc.publicFiles', function () {
'with password': {
description: 'with password',
shareParams: {
password: 'password',
password: 'Pwd:1234',
permissions: 15
}
}
}, function (data, description) {
describe(description, function () {
it('should create a folder', async function () {
const provider = createProvider()
let provider
if (data.shareParams.password) {
provider = createProvider()
} else {
provider = createProvider(false, true)
}
await getCapabilitiesInteraction(provider, testUser, testUserPassword)
await getCurrentUserInformationInteraction(provider, testUser, testUserPassword)
await folderInPublicShareInteraction(
Expand All @@ -441,7 +449,13 @@ describe('oc.publicFiles', function () {
})
})
it('should get content of a file', async function () {
const provider = createProvider()
let provider
if (data.shareParams.password) {
provider = createProvider()
} else {
provider = createProvider(false, true)
}

await getCapabilitiesInteraction(provider, testUser, testUserPassword)
await getCurrentUserInformationInteraction(provider, testUser, testUserPassword)

Expand Down Expand Up @@ -470,7 +484,12 @@ describe('oc.publicFiles', function () {
})

it('should update a file', async function () {
const provider = createProvider()
let provider
if (data.shareParams.password) {
provider = createProvider()
} else {
provider = createProvider(false, true)
}
await getCapabilitiesInteraction(provider, testUser, testUserPassword)
await getCurrentUserInformationInteraction(provider, testUser, testUserPassword)
await publicShareContentInteraction(
Expand Down Expand Up @@ -501,7 +520,13 @@ describe('oc.publicFiles', function () {
const source = shareTokenOfPublicLinkFolder + '/' + testFile
const target = shareTokenOfPublicLinkFolder + '/lorem123456.txt'

const provider = createProvider()
let provider
if (data.shareParams.password) {
provider = createProvider()
} else {
provider = createProvider(false, true)
}

await getCapabilitiesInteraction(provider, testUser, testUserPassword)
await getCurrentUserInformationInteraction(provider, testUser, testUserPassword)

Expand Down Expand Up @@ -549,7 +574,13 @@ describe('oc.publicFiles', function () {
const source = shareTokenOfPublicLinkFolder + '/' + testFile
const target = shareTokenOfPublicLinkFolder + '/foo/lorem.txt'

const provider = createProvider()
let provider
if (data.shareParams.password) {
provider = createProvider()
} else {
provider = createProvider(false, true)
}

await getCapabilitiesInteraction(provider, testUser, testUserPassword)
await getCurrentUserInformationInteraction(provider, testUser, testUserPassword)

Expand Down Expand Up @@ -594,7 +625,13 @@ describe('oc.publicFiles', function () {
})

it('should move a folder', async function () {
const provider = createProvider()
let provider
if (data.shareParams.password) {
provider = createProvider()
} else {
provider = createProvider(false, true)
}

await getCapabilitiesInteraction(provider, testUser, testUserPassword)
await getCurrentUserInformationInteraction(provider, testUser, testUserPassword)

Expand Down

0 comments on commit b027f5e

Please sign in to comment.