Browse Source
fix: adjust testing
fix: adjust testing
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>pull/39196/head
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
11 changed files with 657 additions and 199 deletions
-
1__mocks__/@nextcloud/axios.ts
-
9apps/files_sharing/lib/AppInfo/Application.php
-
6apps/files_sharing/lib/Controller/ShareAPIController.php
-
6apps/files_sharing/lib/Listener/LoadAdditionalListener.php
-
364apps/files_sharing/src/services/SharingService.spec.ts
-
45apps/files_sharing/src/services/SharingService.ts
-
125apps/files_sharing/src/views/shares.spec.ts
-
14apps/files_sharing/src/views/shares.ts
-
120apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
-
125apps/files_sharing/tests/js/appSpec.js
-
41build/integration/sharing_features/sharing-v1-part4.feature
@ -0,0 +1,364 @@ |
|||
/** |
|||
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com> |
|||
* |
|||
* @author John Molakvoæ <skjnldsv@protonmail.com> |
|||
* |
|||
* @license AGPL-3.0-or-later |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU Affero General Public License as |
|||
* published by the Free Software Foundation, either version 3 of the |
|||
* License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU Affero General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Affero General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
* |
|||
*/ |
|||
import { expect } from '@jest/globals' |
|||
import axios from '@nextcloud/axios' |
|||
import { Type } from '@nextcloud/sharing' |
|||
import * as auth from '@nextcloud/auth' |
|||
|
|||
import { getContents, type OCSResponse } from './SharingService' |
|||
import { File, Folder } from '@nextcloud/files' |
|||
import logger from './logger' |
|||
|
|||
global.window.OC = { |
|||
TAG_FAVORITE: '_$!<Favorite>!$_', |
|||
} |
|||
|
|||
describe('SharingService methods definitions', () => { |
|||
beforeAll(() => { |
|||
jest.spyOn(axios, 'get').mockImplementation(async (): Promise<any> => { |
|||
return { |
|||
data: { |
|||
ocs: { |
|||
meta: { |
|||
status: 'ok', |
|||
statuscode: 200, |
|||
message: 'OK', |
|||
}, |
|||
data: [], |
|||
}, |
|||
} as OCSResponse, |
|||
} |
|||
}) |
|||
}) |
|||
|
|||
afterAll(() => { |
|||
jest.restoreAllMocks() |
|||
}) |
|||
|
|||
test('Shared with you', async () => { |
|||
await getContents(true, false, false, false, []) |
|||
|
|||
expect(axios.get).toHaveBeenCalledTimes(2) |
|||
expect(axios.get).toHaveBeenNthCalledWith(1, 'http://localhost/ocs/v2.php/apps/files_sharing/api/v1/shares', { |
|||
headers: { |
|||
'Content-Type': 'application/json', |
|||
}, |
|||
params: { |
|||
shared_with_me: true, |
|||
include_tags: true, |
|||
}, |
|||
}) |
|||
expect(axios.get).toHaveBeenNthCalledWith(2, 'http://localhost/ocs/v2.php/apps/files_sharing/api/v1/remote_shares', { |
|||
headers: { |
|||
'Content-Type': 'application/json', |
|||
}, |
|||
params: { |
|||
include_tags: true, |
|||
}, |
|||
}) |
|||
}) |
|||
|
|||
test('Shared with others', async () => { |
|||
await getContents(false, true, false, false, []) |
|||
|
|||
expect(axios.get).toHaveBeenCalledTimes(1) |
|||
expect(axios.get).toHaveBeenCalledWith('http://localhost/ocs/v2.php/apps/files_sharing/api/v1/shares', { |
|||
headers: { |
|||
'Content-Type': 'application/json', |
|||
}, |
|||
params: { |
|||
shared_with_me: false, |
|||
include_tags: true, |
|||
}, |
|||
}) |
|||
}) |
|||
|
|||
test('Pending shares', async () => { |
|||
await getContents(false, false, true, false, []) |
|||
|
|||
expect(axios.get).toHaveBeenCalledTimes(2) |
|||
expect(axios.get).toHaveBeenNthCalledWith(1, 'http://localhost/ocs/v2.php/apps/files_sharing/api/v1/shares/pending', { |
|||
headers: { |
|||
'Content-Type': 'application/json', |
|||
}, |
|||
params: { |
|||
include_tags: true, |
|||
}, |
|||
}) |
|||
expect(axios.get).toHaveBeenNthCalledWith(2, 'http://localhost/ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending', { |
|||
headers: { |
|||
'Content-Type': 'application/json', |
|||
}, |
|||
params: { |
|||
include_tags: true, |
|||
}, |
|||
}) |
|||
}) |
|||
|
|||
test('Deleted shares', async () => { |
|||
await getContents(false, true, false, false, []) |
|||
|
|||
expect(axios.get).toHaveBeenCalledTimes(1) |
|||
expect(axios.get).toHaveBeenCalledWith('http://localhost/ocs/v2.php/apps/files_sharing/api/v1/shares', { |
|||
headers: { |
|||
'Content-Type': 'application/json', |
|||
}, |
|||
params: { |
|||
shared_with_me: false, |
|||
include_tags: true, |
|||
}, |
|||
}) |
|||
}) |
|||
|
|||
test('Unknown owner', async () => { |
|||
jest.spyOn(auth, 'getCurrentUser').mockReturnValue(null) |
|||
const results = await getContents(false, true, false, false, []) |
|||
|
|||
expect(results.folder.owner).toEqual(null) |
|||
}) |
|||
}) |
|||
|
|||
describe('SharingService filtering', () => { |
|||
beforeAll(() => { |
|||
jest.spyOn(axios, 'get').mockImplementation(async (): Promise<any> => { |
|||
return { |
|||
data: { |
|||
ocs: { |
|||
meta: { |
|||
status: 'ok', |
|||
statuscode: 200, |
|||
message: 'OK', |
|||
}, |
|||
data: [ |
|||
{ |
|||
id: '62', |
|||
share_type: Type.SHARE_TYPE_USER, |
|||
uid_owner: 'test', |
|||
displayname_owner: 'test', |
|||
permissions: 31, |
|||
stime: 1688666292, |
|||
expiration: '2023-07-13 00:00:00', |
|||
token: null, |
|||
path: '/Collaborators', |
|||
item_type: 'folder', |
|||
item_permissions: 31, |
|||
mimetype: 'httpd/unix-directory', |
|||
storage: 224, |
|||
item_source: 419413, |
|||
file_source: 419413, |
|||
file_parent: 419336, |
|||
file_target: '/Collaborators', |
|||
item_size: 41434, |
|||
item_mtime: 1688662980, |
|||
}, |
|||
], |
|||
}, |
|||
}, |
|||
} |
|||
}) |
|||
}) |
|||
|
|||
afterAll(() => { |
|||
jest.restoreAllMocks() |
|||
}) |
|||
|
|||
test('Shared with others filtering', async () => { |
|||
const shares = await getContents(false, true, false, false, [Type.SHARE_TYPE_USER]) |
|||
|
|||
expect(axios.get).toHaveBeenCalledTimes(1) |
|||
expect(shares.contents).toHaveLength(1) |
|||
expect(shares.contents[0].fileid).toBe(419413) |
|||
expect(shares.contents[0]).toBeInstanceOf(Folder) |
|||
}) |
|||
|
|||
test('Shared with others filtering empty', async () => { |
|||
const shares = await getContents(false, true, false, false, [Type.SHARE_TYPE_LINK]) |
|||
|
|||
expect(axios.get).toHaveBeenCalledTimes(1) |
|||
expect(shares.contents).toHaveLength(0) |
|||
}) |
|||
}) |
|||
|
|||
describe('SharingService share to Node mapping', () => { |
|||
const shareFile = { |
|||
id: '66', |
|||
share_type: 0, |
|||
uid_owner: 'test', |
|||
displayname_owner: 'test', |
|||
permissions: 19, |
|||
can_edit: true, |
|||
can_delete: true, |
|||
stime: 1688721609, |
|||
parent: null, |
|||
expiration: '2023-07-14 00:00:00', |
|||
token: null, |
|||
uid_file_owner: 'test', |
|||
note: '', |
|||
label: null, |
|||
displayname_file_owner: 'test', |
|||
path: '/document.md', |
|||
item_type: 'file', |
|||
item_permissions: 27, |
|||
mimetype: 'text/markdown', |
|||
has_preview: true, |
|||
storage_id: 'home::test', |
|||
storage: 224, |
|||
item_source: 530936, |
|||
file_source: 530936, |
|||
file_parent: 419336, |
|||
file_target: '/document.md', |
|||
item_size: 123, |
|||
item_mtime: 1688721600, |
|||
share_with: 'user00', |
|||
share_with_displayname: 'User00', |
|||
share_with_displayname_unique: 'user00@domain.com', |
|||
status: { |
|||
status: 'away', |
|||
message: null, |
|||
icon: null, |
|||
clearAt: null, |
|||
}, |
|||
mail_send: 0, |
|||
hide_download: 0, |
|||
attributes: null, |
|||
tags: [], |
|||
} |
|||
|
|||
const shareFolder = { |
|||
id: '67', |
|||
share_type: 0, |
|||
uid_owner: 'test', |
|||
displayname_owner: 'test', |
|||
permissions: 31, |
|||
can_edit: true, |
|||
can_delete: true, |
|||
stime: 1688721629, |
|||
parent: null, |
|||
expiration: '2023-07-14 00:00:00', |
|||
token: null, |
|||
uid_file_owner: 'test', |
|||
note: '', |
|||
label: null, |
|||
displayname_file_owner: 'test', |
|||
path: '/Folder', |
|||
item_type: 'folder', |
|||
item_permissions: 31, |
|||
mimetype: 'httpd/unix-directory', |
|||
has_preview: false, |
|||
storage_id: 'home::test', |
|||
storage: 224, |
|||
item_source: 531080, |
|||
file_source: 531080, |
|||
file_parent: 419336, |
|||
file_target: '/Folder', |
|||
item_size: 0, |
|||
item_mtime: 1688721623, |
|||
share_with: 'user00', |
|||
share_with_displayname: 'User00', |
|||
share_with_displayname_unique: 'user00@domain.com', |
|||
status: { |
|||
status: 'away', |
|||
message: null, |
|||
icon: null, |
|||
clearAt: null, |
|||
}, |
|||
mail_send: 0, |
|||
hide_download: 0, |
|||
attributes: null, |
|||
tags: [window.OC.TAG_FAVORITE], |
|||
} |
|||
|
|||
test('File', async () => { |
|||
jest.spyOn(axios, 'get').mockReturnValueOnce(Promise.resolve({ |
|||
data: { |
|||
ocs: { |
|||
data: [shareFile], |
|||
}, |
|||
}, |
|||
})) |
|||
|
|||
const shares = await getContents(false, true, false, false) |
|||
|
|||
expect(axios.get).toHaveBeenCalledTimes(1) |
|||
expect(shares.contents).toHaveLength(1) |
|||
|
|||
const file = shares.contents[0] as File |
|||
expect(file).toBeInstanceOf(File) |
|||
expect(file.fileid).toBe(530936) |
|||
expect(file.source).toBe('http://localhost/remote.php/dav/files/test/document.md') |
|||
expect(file.owner).toBe('test') |
|||
expect(file.mime).toBe('text/markdown') |
|||
expect(file.mtime).toBeInstanceOf(Date) |
|||
expect(file.size).toBe(123) |
|||
expect(file.permissions).toBe(27) |
|||
expect(file.root).toBe('/files/test') |
|||
expect(file.attributes).toBeInstanceOf(Object) |
|||
expect(file.attributes['has-preview']).toBe(true) |
|||
expect(file.attributes.previewUrl).toBe('/index.php/core/preview?fileId=530936&x=32&y=32&forceIcon=0') |
|||
expect(file.attributes.favorite).toBe(0) |
|||
}) |
|||
|
|||
test('Folder', async () => { |
|||
jest.spyOn(axios, 'get').mockReturnValueOnce(Promise.resolve({ |
|||
data: { |
|||
ocs: { |
|||
data: [shareFolder], |
|||
}, |
|||
}, |
|||
})) |
|||
|
|||
const shares = await getContents(false, true, false, false) |
|||
|
|||
expect(axios.get).toHaveBeenCalledTimes(1) |
|||
expect(shares.contents).toHaveLength(1) |
|||
|
|||
const folder = shares.contents[0] as Folder |
|||
expect(folder).toBeInstanceOf(Folder) |
|||
expect(folder.fileid).toBe(531080) |
|||
expect(folder.source).toBe('http://localhost/remote.php/dav/files/test/Folder') |
|||
expect(folder.owner).toBe('test') |
|||
expect(folder.mime).toBe('httpd/unix-directory') |
|||
expect(folder.mtime).toBeInstanceOf(Date) |
|||
expect(folder.size).toBe(0) |
|||
expect(folder.permissions).toBe(31) |
|||
expect(folder.root).toBe('/files/test') |
|||
expect(folder.attributes).toBeInstanceOf(Object) |
|||
expect(folder.attributes['has-preview']).toBe(false) |
|||
expect(folder.attributes.previewUrl).toBeUndefined() |
|||
expect(folder.attributes.favorite).toBe(1) |
|||
}) |
|||
|
|||
test('Error', async () => { |
|||
jest.spyOn(logger, 'error').mockImplementationOnce(() => {}) |
|||
jest.spyOn(axios, 'get').mockReturnValueOnce(Promise.resolve({ |
|||
data: { |
|||
ocs: { |
|||
data: [{}], |
|||
}, |
|||
}, |
|||
})) |
|||
|
|||
const shares = await getContents(false, true, false, false) |
|||
expect(shares.contents).toHaveLength(0) |
|||
expect(logger.error).toHaveBeenCalledTimes(1) |
|||
}) |
|||
}) |
|||
@ -0,0 +1,125 @@ |
|||
/** |
|||
* @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com> |
|||
* |
|||
* @author John Molakvoæ <skjnldsv@protonmail.com> |
|||
* |
|||
* @license AGPL-3.0-or-later |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU Affero General Public License as |
|||
* published by the Free Software Foundation, either version 3 of the |
|||
* License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU Affero General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Affero General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
* |
|||
*/ |
|||
/* eslint-disable n/no-extraneous-import */ |
|||
import { expect } from '@jest/globals' |
|||
import axios from '@nextcloud/axios' |
|||
|
|||
import { type Navigation } from '../../../files/src/services/Navigation' |
|||
import { type OCSResponse } from '../services/SharingService' |
|||
import NavigationService from '../../../files/src/services/Navigation' |
|||
import registerSharingViews from './shares' |
|||
|
|||
import '../main' |
|||
import { Folder } from '@nextcloud/files' |
|||
|
|||
describe('Sharing views definition', () => { |
|||
let Navigation |
|||
beforeEach(() => { |
|||
Navigation = new NavigationService() |
|||
window.OCP = { Files: { Navigation } } |
|||
}) |
|||
|
|||
afterAll(() => { |
|||
delete window.OCP |
|||
}) |
|||
|
|||
test('Default values', () => { |
|||
jest.spyOn(Navigation, 'register') |
|||
|
|||
expect(Navigation.views.length).toBe(0) |
|||
|
|||
registerSharingViews() |
|||
const shareOverviewView = Navigation.views.find(view => view.id === 'shareoverview') as Navigation |
|||
const sharesChildViews = Navigation.views.filter(view => view.parent === 'shareoverview') as Navigation[] |
|||
|
|||
expect(Navigation.register).toHaveBeenCalledTimes(6) |
|||
|
|||
// one main view and no children
|
|||
expect(Navigation.views.length).toBe(6) |
|||
expect(shareOverviewView).toBeDefined() |
|||
expect(sharesChildViews.length).toBe(5) |
|||
|
|||
expect(shareOverviewView?.id).toBe('shareoverview') |
|||
expect(shareOverviewView?.name).toBe('Shares') |
|||
expect(shareOverviewView?.caption).toBe('Overview of shared files.') |
|||
expect(shareOverviewView?.icon).toBe('<svg>SvgMock</svg>') |
|||
expect(shareOverviewView?.order).toBe(20) |
|||
expect(shareOverviewView?.columns).toStrictEqual([]) |
|||
expect(shareOverviewView?.getContents).toBeDefined() |
|||
|
|||
const dataProvider = [ |
|||
{ id: 'sharingin', name: 'Shared with you', caption: 'List of files that are shared with you.' }, |
|||
{ id: 'sharingout', name: 'Shared with others', caption: 'List of files that you shared with others.' }, |
|||
{ id: 'sharinglinks', name: 'Shared by link', caption: 'List of files that are shared by link.' }, |
|||
{ id: 'deletedshares', name: 'Deleted shares', caption: 'List of shares that you removed yourself from.' }, |
|||
{ id: 'pendingshares', name: 'Pending shares', caption: 'List of unapproved shares.' }, |
|||
] |
|||
|
|||
sharesChildViews.forEach((view, index) => { |
|||
expect(view?.id).toBe(dataProvider[index].id) |
|||
expect(view?.parent).toBe('shareoverview') |
|||
expect(view?.name).toBe(dataProvider[index].name) |
|||
expect(view?.caption).toBe(dataProvider[index].caption) |
|||
expect(view?.icon).toBe('<svg>SvgMock</svg>') |
|||
expect(view?.order).toBe(index + 1) |
|||
expect(view?.columns).toStrictEqual([]) |
|||
expect(view?.getContents).toBeDefined() |
|||
}) |
|||
}) |
|||
}) |
|||
|
|||
describe('Sharing views contents', () => { |
|||
let Navigation |
|||
beforeEach(() => { |
|||
Navigation = new NavigationService() |
|||
window.OCP = { Files: { Navigation } } |
|||
}) |
|||
|
|||
afterAll(() => { |
|||
delete window.OCP |
|||
}) |
|||
|
|||
test('Sharing overview get contents', async () => { |
|||
jest.spyOn(axios, 'get').mockImplementation(async (): Promise<any> => { |
|||
return { |
|||
data: { |
|||
ocs: { |
|||
meta: { |
|||
status: 'ok', |
|||
statuscode: 200, |
|||
message: 'OK', |
|||
}, |
|||
data: [], |
|||
}, |
|||
} as OCSResponse, |
|||
} |
|||
}) |
|||
|
|||
registerSharingViews() |
|||
expect(Navigation.views.length).toBe(6) |
|||
Navigation.views.forEach(async (view: Navigation) => { |
|||
const content = await view.getContents('/') |
|||
expect(content.contents).toStrictEqual([]) |
|||
expect(content.folder).toBeInstanceOf(Folder) |
|||
}) |
|||
}) |
|||
}) |
|||
@ -1,125 +0,0 @@ |
|||
/** |
|||
* @copyright 2014 Vincent Petry <pvince81@owncloud.com> |
|||
* |
|||
* @author Jan-Christoph Borchardt <hey@jancborchardt.net> |
|||
* @author Morris Jobke <hey@morrisjobke.de> |
|||
* @author Vincent Petry <vincent@nextcloud.com> |
|||
* |
|||
* @license AGPL-3.0-or-later |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU Affero General Public License as |
|||
* published by the Free Software Foundation, either version 3 of the |
|||
* License, or (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU Affero General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Affero General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
* |
|||
*/ |
|||
|
|||
describe('OCA.Sharing.App tests', function() { |
|||
var App = OCA.Sharing.App; |
|||
var fileListIn; |
|||
var fileListOut; |
|||
|
|||
beforeEach(function() { |
|||
$('#testArea').append( |
|||
'<div id="app-navigation">' + |
|||
'<ul><li data-id="files"><a>Files</a></li>' + |
|||
'<li data-id="sharingin"><a></a></li>' + |
|||
'<li data-id="sharingout"><a></a></li>' + |
|||
'</ul></div>' + |
|||
'<div id="app-content">' + |
|||
'<div id="app-content-files" class="hidden">' + |
|||
'</div>' + |
|||
'<div id="app-content-sharingin" class="hidden">' + |
|||
'</div>' + |
|||
'<div id="app-content-sharingout" class="hidden">' + |
|||
'</div>' + |
|||
'</div>' + |
|||
'</div>' |
|||
); |
|||
fileListIn = App.initSharingIn($('#app-content-sharingin')); |
|||
fileListOut = App.initSharingOut($('#app-content-sharingout')); |
|||
}); |
|||
afterEach(function() { |
|||
App.destroy(); |
|||
}); |
|||
|
|||
describe('initialization', function() { |
|||
it('inits sharing-in list on show', function() { |
|||
expect(fileListIn._sharedWithUser).toEqual(true); |
|||
}); |
|||
it('inits sharing-out list on show', function() { |
|||
expect(fileListOut._sharedWithUser).toBeFalsy(); |
|||
}); |
|||
}); |
|||
describe('file actions', function() { |
|||
it('provides default file actions', function() { |
|||
_.each([fileListIn, fileListOut], function(fileList) { |
|||
var fileActions = fileList.fileActions; |
|||
|
|||
expect(fileActions.actions.all).toBeDefined(); |
|||
expect(fileActions.actions.all.Delete).toBeDefined(); |
|||
expect(fileActions.actions.all.Rename).toBeDefined(); |
|||
expect(fileActions.actions.all.Download).toBeDefined(); |
|||
|
|||
expect(fileActions.defaults.dir).toEqual('Open'); |
|||
}); |
|||
}); |
|||
it('provides custom file actions', function() { |
|||
var actionStub = sinon.stub(); |
|||
// regular file action
|
|||
OCA.Files.fileActions.register( |
|||
'all', |
|||
'RegularTest', |
|||
OC.PERMISSION_READ, |
|||
OC.imagePath('core', 'actions/shared'), |
|||
actionStub |
|||
); |
|||
|
|||
App._inFileList = null; |
|||
fileListIn = App.initSharingIn($('#app-content-sharingin')); |
|||
|
|||
expect(fileListIn.fileActions.actions.all.RegularTest).toBeDefined(); |
|||
}); |
|||
it('redirects to files app when opening a directory', function() { |
|||
var oldList = OCA.Files.App.fileList; |
|||
// dummy new list to make sure it exists
|
|||
OCA.Files.App.fileList = new OCA.Files.FileList($('<table><thead></thead><tbody></tbody></table>')); |
|||
|
|||
var setActiveViewStub = sinon.stub(OCA.Files.App, 'setActiveView'); |
|||
// create dummy table so we can click the dom
|
|||
var $table = '<table><thead></thead><tbody class="files-fileList"></tbody></table>'; |
|||
$('#app-content-sharingin').append($table); |
|||
|
|||
App._inFileList = null; |
|||
fileListIn = App.initSharingIn($('#app-content-sharingin')); |
|||
|
|||
fileListIn.setFiles([{ |
|||
name: 'testdir', |
|||
type: 'dir', |
|||
path: '/somewhere/inside/subdir', |
|||
counterParts: ['user2'], |
|||
shareOwner: 'user2' |
|||
}]); |
|||
|
|||
fileListIn.findFileEl('testdir').find('td .nametext').click(); |
|||
|
|||
expect(OCA.Files.App.fileList.getCurrentDirectory()).toEqual('/somewhere/inside/subdir/testdir'); |
|||
|
|||
expect(setActiveViewStub.calledOnce).toEqual(true); |
|||
expect(setActiveViewStub.calledWith('files')).toEqual(true); |
|||
|
|||
setActiveViewStub.restore(); |
|||
|
|||
// restore old list
|
|||
OCA.Files.App.fileList = oldList; |
|||
}); |
|||
}); |
|||
}); |
|||
@ -0,0 +1,41 @@ |
|||
Feature: sharing |
|||
Background: |
|||
Given using api version "1" |
|||
Given using new dav path |
|||
|
|||
# See sharing-v1-part3.feature |
|||
|
|||
Scenario: Creating a new share of a file shows size and mtime |
|||
Given user "user0" exists |
|||
And user "user1" exists |
|||
And As an "user0" |
|||
And parameter "shareapi_default_permissions" of app "core" is set to "7" |
|||
When creating a share with |
|||
| path | welcome.txt | |
|||
| shareWith | user1 | |
|||
| shareType | 0 | |
|||
And the OCS status code should be "100" |
|||
And the HTTP status code should be "200" |
|||
And Getting info of last share |
|||
Then the OCS status code should be "100" |
|||
And the HTTP status code should be "200" |
|||
And Share fields of last share match with |
|||
| item_size | A_NUMBER | |
|||
| item_mtime | A_NUMBER | |
|||
|
|||
Scenario: Creating a new share of a file you own shows the file permissions |
|||
Given user "user0" exists |
|||
And user "user1" exists |
|||
And As an "user0" |
|||
And parameter "shareapi_default_permissions" of app "core" is set to "7" |
|||
When creating a share with |
|||
| path | welcome.txt | |
|||
| shareWith | user1 | |
|||
| shareType | 0 | |
|||
And the OCS status code should be "100" |
|||
And the HTTP status code should be "200" |
|||
And Getting info of last share |
|||
Then the OCS status code should be "100" |
|||
And the HTTP status code should be "200" |
|||
And Share fields of last share match with |
|||
| item_permissions | 27 | |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue