]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/plugins/plugin-helpers.ts
Add job queue hooks
[github/Chocobozzz/PeerTube.git] / server / tests / plugins / plugin-helpers.ts
index 5e8d08dff7154b43b88098ed89e251cfa12e7a32..49807f8f5d69936facb9469cc2811106dbc0510f 100644 (file)
@@ -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
+        })
+      }
     })
   })