import 'mocha'
import { expect } from 'chai'
import { pathExists } from 'fs-extra'
+import { HttpStatusCode, ThumbnailType } from '@shared/models'
import {
- checkVideoFilesWereRemoved,
cleanupTests,
createMultipleServers,
doubleFollow,
setAccessTokensToServers,
waitJobs
} from '@shared/server-commands'
-import { HttpStatusCode, ThumbnailType } from '@shared/models'
+import { checkVideoFilesWereRemoved } from '../shared'
function postCommand (server: PeerTubeServer, command: string, bodyArg?: object) {
const body = { command }
})
describe('User', function () {
+ let rootId: number
it('Should not get a user if not authenticated', async function () {
await makeGetRequest({
expect(res.body.isAdmin).to.be.true
expect(res.body.isModerator).to.be.false
expect(res.body.isUser).to.be.false
+
+ rootId = res.body.id
+ })
+
+ it('Should load a user by id', async function () {
+ {
+ const res = await makeGetRequest({
+ url: servers[0].url,
+ path: '/plugins/test-four/router/user/' + rootId,
+ expectedStatus: HttpStatusCode.OK_200
+ })
+
+ expect(res.body.username).to.equal('root')
+ }
+
+ {
+ await makeGetRequest({
+ url: servers[0].url,
+ path: '/plugins/test-four/router/user/42',
+ expectedStatus: HttpStatusCode.NOT_FOUND_404
+ })
+ }
})
})
// Should not throw -> video exists
const video = await servers[0].videos.get({ id: videoUUID })
// Should delete the video
- await servers[0].videos.view({ id: videoUUID })
+ await servers[0].views.simulateView({ id: videoUUID })
await servers[0].servers.waitUntilLog('Video deleted by plugin four.')