aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/users.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-30 15:16:24 +0100
committerChocobozzz <me@florianbigard.com>2018-01-30 15:16:24 +0100
commitf076daa76a32074cba162459e38fa8c130ad42d0 (patch)
treeea8a92d6305afa158b7774b65e9e6098cc094b92 /server/tests/api/check-params/users.ts
parentecb4e35f4e6c7304cb274593c13cb47fd5078b75 (diff)
downloadPeerTube-f076daa76a32074cba162459e38fa8c130ad42d0.tar.gz
PeerTube-f076daa76a32074cba162459e38fa8c130ad42d0.tar.zst
PeerTube-f076daa76a32074cba162459e38fa8c130ad42d0.zip
Add tests for emails
Diffstat (limited to 'server/tests/api/check-params/users.ts')
-rw-r--r--server/tests/api/check-params/users.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 28fefe79f..0fbc414c9 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -541,6 +541,28 @@ describe('Test users API validators', function () {
541 }) 541 })
542 }) 542 })
543 543
544 describe('When asking a password reset', function () {
545 const path = '/api/v1/users/ask-reset-password'
546
547 it('Should fail with a missing email', async function () {
548 const fields = {}
549
550 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
551 })
552
553 it('Should fail with an invalid email', async function () {
554 const fields = { email: 'hello' }
555
556 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
557 })
558
559 it('Should success with the correct params', async function () {
560 const fields = { email: 'admin@example.com' }
561
562 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 204 })
563 })
564 })
565
544 after(async function () { 566 after(async function () {
545 killallServers([ server, serverWithRegistrationDisabled ]) 567 killallServers([ server, serverWithRegistrationDisabled ])
546 568