From ed56ad1193bb5bb0a81fb843a11eb90d3fed9861 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 26 Apr 2018 10:03:40 +0200 Subject: Add ability to update the user display name/description --- server/tests/api/users/users-multiple-servers.ts | 20 +++++++++++++++++++- server/tests/api/users/users.ts | 23 +++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) (limited to 'server/tests/api') diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index a7f3aa8d3..8b9b63348 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts @@ -76,6 +76,22 @@ describe('Test users with multiple servers', function () { await wait(5000) }) + it('Should be able to update my display name', async function () { + this.timeout(10000) + + await updateMyUser({ + url: servers[0].url, + accessToken: servers[0].accessToken, + displayName: 'my super display name' + }) + + const res = await getMyUserInformation(servers[0].url, servers[0].accessToken) + user = res.body + expect(user.account.displayName).to.equal('my super display name') + + await wait(5000) + }) + it('Should be able to update my description', async function () { this.timeout(10000) @@ -87,6 +103,7 @@ describe('Test users with multiple servers', function () { const res = await getMyUserInformation(servers[0].url, servers[0].accessToken) user = res.body + expect(user.account.displayName).to.equal('my super display name') expect(user.account.description).to.equal('my super description updated') await wait(5000) @@ -111,7 +128,7 @@ describe('Test users with multiple servers', function () { await wait(5000) }) - it('Should have updated my avatar and my description on other servers too', async function () { + it('Should have updated my profile on other servers too', async function () { for (const server of servers) { const resAccounts = await getAccountsList(server.url, '-createdAt') @@ -122,6 +139,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.displayName).to.equal('my super display name') 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 1192ef9e4..1ea599859 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.displayName).to.equal('user_1') expect(user.account.description).to.be.null }) @@ -316,6 +317,7 @@ describe('Test users', function () { expect(user.nsfwPolicy).to.equal('do_not_list') expect(user.videoQuota).to.equal(2 * 1024 * 1024) expect(user.id).to.be.a('number') + expect(user.account.displayName).to.equal('user_1') expect(user.account.description).to.be.null }) @@ -347,6 +349,7 @@ describe('Test users', function () { expect(user.nsfwPolicy).to.equal('do_not_list') expect(user.videoQuota).to.equal(2 * 1024 * 1024) expect(user.id).to.be.a('number') + expect(user.account.displayName).to.equal('user_1') expect(user.account.description).to.be.null }) @@ -365,6 +368,25 @@ describe('Test users', function () { await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.png') }) + it('Should be able to update my display name', async function () { + await updateMyUser({ + url: server.url, + accessToken: accessTokenUser, + displayName: 'new display name' + }) + + 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.nsfwPolicy).to.equal('do_not_list') + expect(user.videoQuota).to.equal(2 * 1024 * 1024) + expect(user.id).to.be.a('number') + expect(user.account.displayName).to.equal('new display name') + expect(user.account.description).to.be.null + }) + it('Should be able to update my description', async function () { await updateMyUser({ url: server.url, @@ -380,6 +402,7 @@ describe('Test users', function () { expect(user.nsfwPolicy).to.equal('do_not_list') expect(user.videoQuota).to.equal(2 * 1024 * 1024) expect(user.id).to.be.a('number') + expect(user.account.displayName).to.equal('new display name') expect(user.account.description).to.equal('my super description updated') }) -- cgit v1.2.3