]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/users/users.ts
Move test functions outside extra-utils
[github/Chocobozzz/PeerTube.git] / server / tests / api / users / users.ts
index 6c41e7d560146e5e5a589ce11c24e3addfc0f310..ff9172a82e664ff2ac294458af6d911d221cf3ff 100644 (file)
@@ -2,6 +2,8 @@
 
 import 'mocha'
 import * as chai from 'chai'
+import { testImage } from '@server/tests/shared'
+import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
 import {
   cleanupTests,
   createSingleServer,
@@ -9,10 +11,8 @@ import {
   makePutBodyRequest,
   PeerTubeServer,
   setAccessTokensToServers,
-  testImage,
   waitJobs
-} from '@shared/extra-utils'
-import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
+} from '@shared/server-commands'
 
 const expect = chai.expect
 
@@ -559,6 +559,28 @@ describe('Test users', function () {
       expect(user.autoPlayNextVideo).to.be.true
     })
 
+    it('Should be able to change the p2p attribute', async function () {
+      {
+        await server.users.updateMe({
+          token: userToken,
+          webTorrentEnabled: false
+        })
+
+        const user = await server.users.getMyInfo({ token: userToken })
+        expect(user.p2pEnabled).to.be.false
+      }
+
+      {
+        await server.users.updateMe({
+          token: userToken,
+          p2pEnabled: true
+        })
+
+        const user = await server.users.getMyInfo({ token: userToken })
+        expect(user.p2pEnabled).to.be.true
+      }
+    })
+
     it('Should be able to change the email attribute', async function () {
       await server.users.updateMe({
         token: userToken,