aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/user-notifications.ts51
-rw-r--r--server/tests/api/check-params/users.ts3
2 files changed, 42 insertions, 12 deletions
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts
index 635f5c9a3..714f481e9 100644
--- a/server/tests/api/check-params/user-notifications.ts
+++ b/server/tests/api/check-params/user-notifications.ts
@@ -100,6 +100,16 @@ describe('Test user notifications API validators', function () {
100 url: server.url, 100 url: server.url,
101 path, 101 path,
102 fields: { 102 fields: {
103 ids: [ ]
104 },
105 token: server.accessToken,
106 statusCodeExpected: 400
107 })
108
109 await makePostBodyRequest({
110 url: server.url,
111 path,
112 fields: {
103 ids: 5 113 ids: 5
104 }, 114 },
105 token: server.accessToken, 115 token: server.accessToken,
@@ -131,18 +141,39 @@ describe('Test user notifications API validators', function () {
131 }) 141 })
132 }) 142 })
133 143
144 describe('When marking as read my notifications', function () {
145 const path = '/api/v1/users/me/notifications/read-all'
146
147 it('Should fail with a non authenticated user', async function () {
148 await makePostBodyRequest({
149 url: server.url,
150 path,
151 statusCodeExpected: 401
152 })
153 })
154
155 it('Should succeed with the correct parameters', async function () {
156 await makePostBodyRequest({
157 url: server.url,
158 path,
159 token: server.accessToken,
160 statusCodeExpected: 204
161 })
162 })
163 })
164
134 describe('When updating my notification settings', function () { 165 describe('When updating my notification settings', function () {
135 const path = '/api/v1/users/me/notification-settings' 166 const path = '/api/v1/users/me/notification-settings'
136 const correctFields: UserNotificationSetting = { 167 const correctFields: UserNotificationSetting = {
137 newVideoFromSubscription: UserNotificationSettingValue.WEB_NOTIFICATION, 168 newVideoFromSubscription: UserNotificationSettingValue.WEB,
138 newCommentOnMyVideo: UserNotificationSettingValue.WEB_NOTIFICATION, 169 newCommentOnMyVideo: UserNotificationSettingValue.WEB,
139 videoAbuseAsModerator: UserNotificationSettingValue.WEB_NOTIFICATION, 170 videoAbuseAsModerator: UserNotificationSettingValue.WEB,
140 blacklistOnMyVideo: UserNotificationSettingValue.WEB_NOTIFICATION, 171 blacklistOnMyVideo: UserNotificationSettingValue.WEB,
141 myVideoImportFinished: UserNotificationSettingValue.WEB_NOTIFICATION, 172 myVideoImportFinished: UserNotificationSettingValue.WEB,
142 myVideoPublished: UserNotificationSettingValue.WEB_NOTIFICATION, 173 myVideoPublished: UserNotificationSettingValue.WEB,
143 commentMention: UserNotificationSettingValue.WEB_NOTIFICATION, 174 commentMention: UserNotificationSettingValue.WEB,
144 newFollow: UserNotificationSettingValue.WEB_NOTIFICATION, 175 newFollow: UserNotificationSettingValue.WEB,
145 newUserRegistration: UserNotificationSettingValue.WEB_NOTIFICATION 176 newUserRegistration: UserNotificationSettingValue.WEB
146 } 177 }
147 178
148 it('Should fail with missing fields', async function () { 179 it('Should fail with missing fields', async function () {
@@ -150,7 +181,7 @@ describe('Test user notifications API validators', function () {
150 url: server.url, 181 url: server.url,
151 path, 182 path,
152 token: server.accessToken, 183 token: server.accessToken,
153 fields: { newVideoFromSubscription: UserNotificationSettingValue.WEB_NOTIFICATION }, 184 fields: { newVideoFromSubscription: UserNotificationSettingValue.WEB },
154 statusCodeExpected: 400 185 statusCodeExpected: 400
155 }) 186 })
156 }) 187 })
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index f8044cbd4..a3e8e2e9c 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -485,11 +485,10 @@ describe('Test users API validators', function () {
485 email: 'email@example.com', 485 email: 'email@example.com',
486 emailVerified: true, 486 emailVerified: true,
487 videoQuota: 42, 487 videoQuota: 42,
488 role: UserRole.MODERATOR 488 role: UserRole.USER
489 } 489 }
490 490
491 await makePutBodyRequest({ url: server.url, path: path + userId, token: server.accessToken, fields, statusCodeExpected: 204 }) 491 await makePutBodyRequest({ url: server.url, path: path + userId, token: server.accessToken, fields, statusCodeExpected: 204 })
492 userAccessToken = await userLogin(server, user)
493 }) 492 })
494 }) 493 })
495 494