X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fplugins%2Fplugin-helpers.ts;h=49807f8f5d69936facb9469cc2811106dbc0510f;hb=22df69fdecf299c8be6acaa25f086249ea9a0085;hp=5e8d08dff7154b43b88098ed89e251cfa12e7a32;hpb=7a9e420a02434e4f16c99e7d58da9075dff25d15;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts index 5e8d08dff..49807f8f5 100644 --- a/server/tests/plugins/plugin-helpers.ts +++ b/server/tests/plugins/plugin-helpers.ts @@ -110,6 +110,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 +133,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 + }) + } }) })