aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-15 14:46:26 +0100
committerChocobozzz <me@florianbigard.com>2018-02-15 15:29:07 +0100
commit2422c46b27790d94fd29a7092170cee5a1b56008 (patch)
treed5c1942ce20cadb27a551d87c789edfe92f5b105 /server/tests/api/users
parent34cbef8c6cc912143a421413bdd832c4adcc556a (diff)
downloadPeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.gz
PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.tar.zst
PeerTube-2422c46b27790d94fd29a7092170cee5a1b56008.zip
Implement support field in video and video channel
Diffstat (limited to 'server/tests/api/users')
-rw-r--r--server/tests/api/users/users-multiple-servers.ts24
-rw-r--r--server/tests/api/users/users.ts21
2 files changed, 43 insertions, 2 deletions
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index 3c4eaff14..bb458f7a5 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -3,7 +3,10 @@
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { Account } from '../../../../shared/models/actors' 5import { Account } from '../../../../shared/models/actors'
6import { checkVideoFilesWereRemoved, createUser, doubleFollow, flushAndRunMultipleServers, removeUser, userLogin, wait } from '../../utils' 6import {
7 checkVideoFilesWereRemoved, createUser, doubleFollow, flushAndRunMultipleServers, removeUser, updateMyUser, userLogin,
8 wait
9} from '../../utils'
7import { flushTests, getMyUserInformation, killallServers, ServerInfo, testImage, updateMyAvatar, uploadVideo } from '../../utils/index' 10import { flushTests, getMyUserInformation, killallServers, ServerInfo, testImage, updateMyAvatar, uploadVideo } from '../../utils/index'
8import { checkActorFilesWereRemoved, getAccount, getAccountsList } from '../../utils/users/accounts' 11import { checkActorFilesWereRemoved, getAccount, getAccountsList } from '../../utils/users/accounts'
9import { setAccessTokensToServers } from '../../utils/users/login' 12import { setAccessTokensToServers } from '../../utils/users/login'
@@ -51,6 +54,22 @@ describe('Test users with multiple servers', function () {
51 await wait(5000) 54 await wait(5000)
52 }) 55 })
53 56
57 it('Should be able to update my description', async function () {
58 this.timeout(10000)
59
60 await updateMyUser({
61 url: servers[0].url,
62 accessToken: servers[0].accessToken,
63 description: 'my super description updated'
64 })
65
66 const res = await getMyUserInformation(servers[0].url, servers[0].accessToken)
67 user = res.body
68 expect(user.account.description).to.equal('my super description updated')
69
70 await wait(5000)
71 })
72
54 it('Should be able to update my avatar', async function () { 73 it('Should be able to update my avatar', async function () {
55 this.timeout(10000) 74 this.timeout(10000)
56 75
@@ -70,7 +89,7 @@ describe('Test users with multiple servers', function () {
70 await wait(5000) 89 await wait(5000)
71 }) 90 })
72 91
73 it('Should have updated my avatar on other servers too', async function () { 92 it('Should have updated my avatar and my description on other servers too', async function () {
74 for (const server of servers) { 93 for (const server of servers) {
75 const resAccounts = await getAccountsList(server.url, '-createdAt') 94 const resAccounts = await getAccountsList(server.url, '-createdAt')
76 95
@@ -81,6 +100,7 @@ describe('Test users with multiple servers', function () {
81 const rootServer1Get = resAccount.body as Account 100 const rootServer1Get = resAccount.body as Account
82 expect(rootServer1Get.name).to.equal('root') 101 expect(rootServer1Get.name).to.equal('root')
83 expect(rootServer1Get.host).to.equal('localhost:9001') 102 expect(rootServer1Get.host).to.equal('localhost:9001')
103 expect(rootServer1Get.description).to.equal('my super description updated')
84 104
85 await testImage(server.url, 'avatar2-resized', rootServer1Get.avatar.path, '.png') 105 await testImage(server.url, 'avatar2-resized', rootServer1Get.avatar.path, '.png')
86 } 106 }
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index ac167d4f9..c650a74f5 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -172,6 +172,7 @@ describe('Test users', function () {
172 expect(user.videoQuota).to.equal(2 * 1024 * 1024) 172 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
173 expect(user.roleLabel).to.equal('User') 173 expect(user.roleLabel).to.equal('User')
174 expect(user.id).to.be.a('number') 174 expect(user.id).to.be.a('number')
175 expect(user.account.description).to.be.null
175 }) 176 })
176 177
177 it('Should be able to upload a video with this user', async function () { 178 it('Should be able to upload a video with this user', async function () {
@@ -315,6 +316,7 @@ describe('Test users', function () {
315 expect(user.displayNSFW).to.be.ok 316 expect(user.displayNSFW).to.be.ok
316 expect(user.videoQuota).to.equal(2 * 1024 * 1024) 317 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
317 expect(user.id).to.be.a('number') 318 expect(user.id).to.be.a('number')
319 expect(user.account.description).to.be.null
318 }) 320 })
319 321
320 it('Should be able to change the autoPlayVideo attribute', async function () { 322 it('Should be able to change the autoPlayVideo attribute', async function () {
@@ -345,6 +347,7 @@ describe('Test users', function () {
345 expect(user.displayNSFW).to.be.ok 347 expect(user.displayNSFW).to.be.ok
346 expect(user.videoQuota).to.equal(2 * 1024 * 1024) 348 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
347 expect(user.id).to.be.a('number') 349 expect(user.id).to.be.a('number')
350 expect(user.account.description).to.be.null
348 }) 351 })
349 352
350 it('Should be able to update my avatar', async function () { 353 it('Should be able to update my avatar', async function () {
@@ -362,6 +365,24 @@ describe('Test users', function () {
362 await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.png') 365 await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.png')
363 }) 366 })
364 367
368 it('Should be able to update my description', async function () {
369 await updateMyUser({
370 url: server.url,
371 accessToken: accessTokenUser,
372 description: 'my super description updated'
373 })
374
375 const res = await getMyUserInformation(server.url, accessTokenUser)
376 const user = res.body
377
378 expect(user.username).to.equal('user_1')
379 expect(user.email).to.equal('updated@example.com')
380 expect(user.displayNSFW).to.be.ok
381 expect(user.videoQuota).to.equal(2 * 1024 * 1024)
382 expect(user.id).to.be.a('number')
383 expect(user.account.description).to.equal('my super description updated')
384 })
385
365 it('Should be able to update another user', async function () { 386 it('Should be able to update another user', async function () {
366 await updateUser({ 387 await updateUser({
367 url: server.url, 388 url: server.url,