let channelId: number
let channelName: string
let video: VideoCreateResult
+ let privateVideo: VideoCreateResult
// ---------------------------------------------------------------
await setAccessTokensToServers([ server ])
- const username = 'user1'
- const password = 'my super password'
- await server.users.create({ username: username, password: password })
- userAccessToken = await server.login.getAccessToken({ username, password })
+ userAccessToken = await server.users.generateUserAndToken('user1')
{
const body = await server.users.getMyInfo()
channelName = body.videoChannels[0].name
accountName = body.account.name + '@' + body.account.host
}
+
+ {
+ privateVideo = await server.videos.quickUpload({ name: 'private video', privacy: VideoPrivacy.PRIVATE })
+ }
})
describe('When listing videos', function () {
support: 'my super support text',
tags: [ 'tag1', 'tag2' ],
privacy: VideoPrivacy.PUBLIC,
- channelId: channelId,
+ channelId,
originallyPublishedAt: new Date().toISOString()
}
})
await makePutBodyRequest({ url: server.url, path: path + videoId + '/rate', token: server.accessToken, fields })
})
+ it('Should fail with a private video of another user', async function () {
+ const fields = {
+ rating: 'like'
+ }
+ await makePutBodyRequest({
+ url: server.url,
+ path: path + privateVideo.uuid + '/rate',
+ token: userAccessToken,
+ fields,
+ expectedStatus: HttpStatusCode.FORBIDDEN_403
+ })
+ })
+
it('Should succeed with the correct parameters', async function () {
const fields = {
rating: 'like'