From 2422c46b27790d94fd29a7092170cee5a1b56008 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Feb 2018 14:46:26 +0100 Subject: Implement support field in video and video channel --- server/tests/api/users/users-multiple-servers.ts | 24 ++++++++++++++++++++++-- server/tests/api/users/users.ts | 21 +++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) (limited to 'server/tests/api/users') 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 @@ import * as chai from 'chai' import 'mocha' import { Account } from '../../../../shared/models/actors' -import { checkVideoFilesWereRemoved, createUser, doubleFollow, flushAndRunMultipleServers, removeUser, userLogin, wait } from '../../utils' +import { + checkVideoFilesWereRemoved, createUser, doubleFollow, flushAndRunMultipleServers, removeUser, updateMyUser, userLogin, + wait +} from '../../utils' import { flushTests, getMyUserInformation, killallServers, ServerInfo, testImage, updateMyAvatar, uploadVideo } from '../../utils/index' import { checkActorFilesWereRemoved, getAccount, getAccountsList } from '../../utils/users/accounts' import { setAccessTokensToServers } from '../../utils/users/login' @@ -51,6 +54,22 @@ describe('Test users with multiple servers', function () { await wait(5000) }) + it('Should be able to update my description', async function () { + this.timeout(10000) + + await updateMyUser({ + url: servers[0].url, + accessToken: servers[0].accessToken, + description: 'my super description updated' + }) + + const res = await getMyUserInformation(servers[0].url, servers[0].accessToken) + user = res.body + expect(user.account.description).to.equal('my super description updated') + + await wait(5000) + }) + it('Should be able to update my avatar', async function () { this.timeout(10000) @@ -70,7 +89,7 @@ describe('Test users with multiple servers', function () { await wait(5000) }) - it('Should have updated my avatar on other servers too', async function () { + it('Should have updated my avatar and my description on other servers too', async function () { for (const server of servers) { const resAccounts = await getAccountsList(server.url, '-createdAt') @@ -81,6 +100,7 @@ describe('Test users with multiple servers', function () { const rootServer1Get = resAccount.body as Account expect(rootServer1Get.name).to.equal('root') expect(rootServer1Get.host).to.equal('localhost:9001') + expect(rootServer1Get.description).to.equal('my super description updated') await testImage(server.url, 'avatar2-resized', rootServer1Get.avatar.path, '.png') } 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 () { expect(user.videoQuota).to.equal(2 * 1024 * 1024) expect(user.roleLabel).to.equal('User') expect(user.id).to.be.a('number') + expect(user.account.description).to.be.null }) it('Should be able to upload a video with this user', async function () { @@ -315,6 +316,7 @@ describe('Test users', function () { expect(user.displayNSFW).to.be.ok expect(user.videoQuota).to.equal(2 * 1024 * 1024) expect(user.id).to.be.a('number') + expect(user.account.description).to.be.null }) it('Should be able to change the autoPlayVideo attribute', async function () { @@ -345,6 +347,7 @@ describe('Test users', function () { expect(user.displayNSFW).to.be.ok expect(user.videoQuota).to.equal(2 * 1024 * 1024) expect(user.id).to.be.a('number') + expect(user.account.description).to.be.null }) it('Should be able to update my avatar', async function () { @@ -362,6 +365,24 @@ describe('Test users', function () { await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.png') }) + it('Should be able to update my description', async function () { + await updateMyUser({ + url: server.url, + accessToken: accessTokenUser, + description: 'my super description updated' + }) + + const res = await getMyUserInformation(server.url, accessTokenUser) + const user = res.body + + expect(user.username).to.equal('user_1') + expect(user.email).to.equal('updated@example.com') + expect(user.displayNSFW).to.be.ok + expect(user.videoQuota).to.equal(2 * 1024 * 1024) + expect(user.id).to.be.a('number') + expect(user.account.description).to.equal('my super description updated') + }) + it('Should be able to update another user', async function () { await updateUser({ url: server.url, -- cgit v1.2.3