Fix migrations
This commit is contained in:
parent
f304a1580b
commit
6def7d34e6
|
@ -65,7 +65,7 @@ async function getMigrationScripts () {
|
||||||
}[] = []
|
}[] = []
|
||||||
|
|
||||||
files
|
files
|
||||||
.filter(file => file.endsWith('.js.map') === false)
|
.filter(file => file.endsWith('.js'))
|
||||||
.forEach(file => {
|
.forEach(file => {
|
||||||
// Filename is something like 'version-blabla.js'
|
// Filename is something like 'version-blabla.js'
|
||||||
const version = file.split('-')[0]
|
const version = file.split('-')[0]
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
|
import { VideoPrivacy } from '@shared/models'
|
||||||
import {
|
import {
|
||||||
cleanupTests,
|
cleanupTests,
|
||||||
createMultipleServers,
|
createMultipleServers,
|
||||||
|
@ -32,20 +33,18 @@ describe('Test users subscriptions', function () {
|
||||||
// Server 1 and server 2 follow each other
|
// Server 1 and server 2 follow each other
|
||||||
await doubleFollow(servers[0], servers[1])
|
await doubleFollow(servers[0], servers[1])
|
||||||
|
|
||||||
{
|
for (const server of servers) {
|
||||||
for (const server of servers) {
|
const user = { username: 'user' + server.serverNumber, password: 'password' }
|
||||||
const user = { username: 'user' + server.serverNumber, password: 'password' }
|
await server.users.create({ username: user.username, password: user.password })
|
||||||
await server.users.create({ username: user.username, password: user.password })
|
|
||||||
|
|
||||||
const accessToken = await server.login.getAccessToken(user)
|
const accessToken = await server.login.getAccessToken(user)
|
||||||
users.push({ accessToken })
|
users.push({ accessToken })
|
||||||
|
|
||||||
const videoName1 = 'video 1-' + server.serverNumber
|
const videoName1 = 'video 1-' + server.serverNumber
|
||||||
await server.videos.upload({ token: accessToken, attributes: { name: videoName1 } })
|
await server.videos.upload({ token: accessToken, attributes: { name: videoName1 } })
|
||||||
|
|
||||||
const videoName2 = 'video 2-' + server.serverNumber
|
const videoName2 = 'video 2-' + server.serverNumber
|
||||||
await server.videos.upload({ token: accessToken, attributes: { name: videoName2 } })
|
await server.videos.upload({ token: accessToken, attributes: { name: videoName2 } })
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
@ -540,6 +539,40 @@ describe('Test users subscriptions', function () {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Should update video as internal and not see from remote server', async function () {
|
||||||
|
this.timeout(30000)
|
||||||
|
|
||||||
|
await servers[2].videos.update({ id: video3UUID, attributes: { name: 'internal', privacy: VideoPrivacy.INTERNAL } })
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
{
|
||||||
|
const { data } = await command.listVideos({ token: users[0].accessToken })
|
||||||
|
expect(data.find(v => v.name === 'internal')).to.not.exist
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should see internal from local user', async function () {
|
||||||
|
const { data } = await servers[2].subscriptions.listVideos({ token: servers[2].accessToken })
|
||||||
|
expect(data.find(v => v.name === 'internal')).to.exist
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should update video as private and not see from anyone server', async function () {
|
||||||
|
this.timeout(30000)
|
||||||
|
|
||||||
|
await servers[2].videos.update({ id: video3UUID, attributes: { name: 'private', privacy: VideoPrivacy.PRIVATE } })
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
{
|
||||||
|
const { data } = await command.listVideos({ token: users[0].accessToken })
|
||||||
|
expect(data.find(v => v.name === 'private')).to.not.exist
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const { data } = await servers[2].subscriptions.listVideos({ token: servers[2].accessToken })
|
||||||
|
expect(data.find(v => v.name === 'private')).to.not.exist
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
await cleanupTests(servers)
|
await cleanupTests(servers)
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,7 +5,8 @@ import { program } from 'commander'
|
||||||
import { accessSync, constants } from 'fs'
|
import { accessSync, constants } from 'fs'
|
||||||
import { remove } from 'fs-extra'
|
import { remove } from 'fs-extra'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { sha256, wait } from '@shared/core-utils'
|
import { sha256 } from '@shared/extra-utils'
|
||||||
|
import { wait } from '@shared/core-utils'
|
||||||
import { doRequestAndSaveToFile } from '../helpers/requests'
|
import { doRequestAndSaveToFile } from '../helpers/requests'
|
||||||
import {
|
import {
|
||||||
assignToken,
|
assignToken,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user