+ await uploadVideo(server.url, server.accessToken, {}, 403)
+ })
+ })
+
+ describe('When having an absolute and daily video quota', function () {
+ it('Should fail if exceeding total quota', async function () {
+ await updateUser({
+ url: server.url,
+ userId: rootId,
+ accessToken: server.accessToken,
+ videoQuota: 42,
+ videoQuotaDaily: 1024 * 1024 * 1024
+ })
+
+ await uploadVideo(server.url, server.accessToken, {}, 403)
+ })
+
+ it('Should fail if exceeding daily quota', async function () {
+ await updateUser({
+ url: server.url,
+ userId: rootId,
+ accessToken: server.accessToken,
+ videoQuota: 1024 * 1024 * 1024,
+ videoQuotaDaily: 42
+ })
+
+ await uploadVideo(server.url, server.accessToken, {}, 403)
+ })
+ })
+
+ describe('When asking a password reset', function () {
+ const path = '/api/v1/users/ask-reset-password'
+
+ it('Should fail with a missing email', async function () {
+ const fields = {}
+
+ await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
+ })
+
+ it('Should fail with an invalid email', async function () {
+ const fields = { email: 'hello' }
+
+ await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
+ })
+
+ it('Should success with the correct params', async function () {
+ const fields = { email: 'admin@example.com' }
+
+ await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 204 })
+ })
+ })
+
+ describe('When asking for an account verification email', function () {
+ const path = '/api/v1/users/ask-send-verify-email'
+
+ it('Should fail with a missing email', async function () {
+ const fields = {}
+
+ await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
+ })
+
+ it('Should fail with an invalid email', async function () {
+ const fields = { email: 'hello' }
+
+ await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
+ })
+
+ it('Should succeed with the correct params', async function () {
+ const fields = { email: 'admin@example.com' }
+
+ await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 204 })
+ })
+ })
+
+ after(async function () {
+ await cleanupTests([ server, serverWithRegistrationDisabled ])