import { HttpStatusCode } from '@shared/core-utils'
import {
buildAbsoluteFixturePath,
- buildServerDirectory,
+ cleanupTests,
flushAndRunServer,
- getMyUserInformation,
prepareResumableUpload,
- sendDebugCommand,
sendResumableChunks,
ServerInfo,
setAccessTokensToServers,
- setDefaultVideoChannel,
- updateUser
+ setDefaultVideoChannel
} from '@shared/extra-utils'
-import { MyUser, VideoPrivacy } from '@shared/models'
+import { VideoPrivacy } from '@shared/models'
const expect = chai.expect
const uploadId = uploadIdArg.replace(/^upload_id=/, '')
const subPath = join('tmp', 'resumable-uploads', uploadId)
- const filePath = buildServerDirectory(server, subPath)
+ const filePath = server.serversCommand.buildDirectory(subPath)
const exists = await pathExists(filePath)
if (expectedSize === null) {
async function countResumableUploads () {
const subPath = join('tmp', 'resumable-uploads')
- const filePath = buildServerDirectory(server, subPath)
+ const filePath = server.serversCommand.buildDirectory(subPath)
const files = await readdir(filePath)
return files.length
await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ])
- const res = await getMyUserInformation(server.url, server.accessToken)
- rootId = (res.body as MyUser).id
+ const body = await server.usersCommand.getMyInfo()
+ rootId = body.id
- await updateUser({
- url: server.url,
- userId: rootId,
- accessToken: server.accessToken,
- videoQuota: 10_000_000
- })
+ await server.usersCommand.update({ userId: rootId, videoQuota: 10_000_000 })
})
describe('Directory cleaning', function () {
})
it('Should not delete recent uploads', async function () {
- await sendDebugCommand(server.url, server.accessToken, { command: 'remove-dandling-resumable-uploads' })
+ await server.debugCommand.sendCommand({ body: { command: 'remove-dandling-resumable-uploads' } })
expect(await countResumableUploads()).to.equal(2)
})
it('Should delete old uploads', async function () {
- await sendDebugCommand(server.url, server.accessToken, { command: 'remove-dandling-resumable-uploads' })
+ await server.debugCommand.sendCommand({ body: { command: 'remove-dandling-resumable-uploads' } })
expect(await countResumableUploads()).to.equal(0)
})
})
})
+ after(async function () {
+ await cleanupTests([ server ])
+ })
})