X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fplugins%2Fplugin-helpers.ts;h=955d7ddfd1370536f2da036c7cb94e8b93632dac;hb=ca68986083edfc530985f47007a099b94cd65325;hp=167429ef4611d14e21360b7b7e32f5dc5a96cbf9;hpb=3318147300b4f998adf728eb0a5a14a4c1829c51;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts index 167429ef4..955d7ddfd 100644 --- a/server/tests/plugins/plugin-helpers.ts +++ b/server/tests/plugins/plugin-helpers.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' import { expect } from 'chai' import { pathExists } from 'fs-extra' import { HttpStatusCode, ThumbnailType } from '@shared/models' @@ -110,6 +109,7 @@ describe('Test plugin helpers', function () { }) describe('User', function () { + let rootId: number it('Should not get a user if not authenticated', async function () { await makeGetRequest({ @@ -132,6 +132,28 @@ describe('Test plugin helpers', function () { 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 + }) + } }) }) @@ -301,7 +323,7 @@ describe('Test plugin helpers', function () { // 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.')