+ it('Should be able to create a new user', async function () {
+ await createUser({
+ url: server.url,
+ accessToken: accessToken,
+ username: user.username,
+ password: user.password,
+ videoQuota: 2 * 1024 * 1024,
+ adminFlags: UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST
+ })
+ })
+
+ it('Should be able to login with this user', async function () {
+ accessTokenUser = await userLogin(server, user)
+ })
+
+ it('Should be able to get user information', async function () {
+ const res1 = await getMyUserInformation(server.url, accessTokenUser)
+ const userMe: MyUser = res1.body
+
+ const res2 = await getUserInformation(server.url, server.accessToken, userMe.id, true)
+ const userGet: User = res2.body
+
+ for (const user of [ userMe, userGet ]) {
+ expect(user.username).to.equal('user_1')
+ expect(user.email).to.equal('user_1@example.com')
+ expect(user.nsfwPolicy).to.equal('display')
+ 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
+ }
+
+ expect(userMe.adminFlags).to.be.undefined
+ expect(userGet.adminFlags).to.equal(UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST)
+
+ expect(userMe.specialPlaylists).to.have.lengthOf(1)
+ expect(userMe.specialPlaylists[0].type).to.equal(VideoPlaylistType.WATCH_LATER)
+
+ // Check stats are included with withStats
+ expect(userGet.videosCount).to.be.a('number')
+ expect(userGet.videosCount).to.equal(0)
+ expect(userGet.videoCommentsCount).to.be.a('number')
+ expect(userGet.videoCommentsCount).to.equal(0)
+ expect(userGet.videoAbusesCount).to.be.a('number')
+ expect(userGet.videoAbusesCount).to.equal(0)
+ expect(userGet.videoAbusesAcceptedCount).to.be.a('number')
+ expect(userGet.videoAbusesAcceptedCount).to.equal(0)
+ })