mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Add email to users
This commit is contained in:
@@ -39,7 +39,7 @@ describe('Test pods API validators', function () {
|
||||
], done)
|
||||
})
|
||||
|
||||
describe('When making friends', function () {
|
||||
describe('When managing friends', function () {
|
||||
let userAccessToken = null
|
||||
|
||||
before(function (done) {
|
||||
@@ -156,13 +156,32 @@ describe('Test pods API validators', function () {
|
||||
|
||||
it('Should fail without public key', function (done) {
|
||||
const data = {
|
||||
email: 'testexample.com',
|
||||
host: 'coucou.com'
|
||||
}
|
||||
requestsUtils.makePostBodyRequest(server.url, path, null, data, done)
|
||||
})
|
||||
|
||||
it('Should fail without an email', function (done) {
|
||||
const data = {
|
||||
host: 'coucou.com',
|
||||
publicKey: 'mysuperpublickey'
|
||||
}
|
||||
requestsUtils.makePostBodyRequest(server.url, path, null, data, done)
|
||||
})
|
||||
|
||||
it('Should fail without an invalid email', function (done) {
|
||||
const data = {
|
||||
host: 'coucou.com',
|
||||
email: 'testexample.com',
|
||||
publicKey: 'mysuperpublickey'
|
||||
}
|
||||
requestsUtils.makePostBodyRequest(server.url, path, null, data, done)
|
||||
})
|
||||
|
||||
it('Should fail without an host', function (done) {
|
||||
const data = {
|
||||
email: 'testexample.com',
|
||||
publicKey: 'mysuperpublickey'
|
||||
}
|
||||
requestsUtils.makePostBodyRequest(server.url, path, null, data, done)
|
||||
@@ -171,6 +190,7 @@ describe('Test pods API validators', function () {
|
||||
it('Should fail with an incorrect host', function (done) {
|
||||
const data = {
|
||||
host: 'http://coucou.com',
|
||||
email: 'testexample.com',
|
||||
publicKey: 'mysuperpublickey'
|
||||
}
|
||||
requestsUtils.makePostBodyRequest(server.url, path, null, data, function () {
|
||||
@@ -185,6 +205,7 @@ describe('Test pods API validators', function () {
|
||||
it('Should succeed with the correct parameters', function (done) {
|
||||
const data = {
|
||||
host: 'coucou.com',
|
||||
email: 'test@example.com',
|
||||
publicKey: 'mysuperpublickey'
|
||||
}
|
||||
requestsUtils.makePostBodyRequest(server.url, path, null, data, done, 200)
|
||||
@@ -193,6 +214,7 @@ describe('Test pods API validators', function () {
|
||||
it('Should fail with a host that already exists', function (done) {
|
||||
const data = {
|
||||
host: 'coucou.com',
|
||||
email: 'test@example.com',
|
||||
publicKey: 'mysuperpublickey'
|
||||
}
|
||||
requestsUtils.makePostBodyRequest(server.url, path, null, data, done, 409)
|
||||
|
||||
@@ -92,6 +92,7 @@ describe('Test users API validators', function () {
|
||||
it('Should fail with a too small username', function (done) {
|
||||
const data = {
|
||||
username: 'ji',
|
||||
email: 'test@example.com',
|
||||
password: 'mysuperpassword'
|
||||
}
|
||||
|
||||
@@ -101,6 +102,7 @@ describe('Test users API validators', function () {
|
||||
it('Should fail with a too long username', function (done) {
|
||||
const data = {
|
||||
username: 'mysuperusernamewhichisverylong',
|
||||
email: 'test@example.com',
|
||||
password: 'mysuperpassword'
|
||||
}
|
||||
|
||||
@@ -110,6 +112,26 @@ describe('Test users API validators', function () {
|
||||
it('Should fail with an incorrect username', function (done) {
|
||||
const data = {
|
||||
username: 'my username',
|
||||
email: 'test@example.com',
|
||||
password: 'mysuperpassword'
|
||||
}
|
||||
|
||||
requestsUtils.makePostBodyRequest(server.url, path, server.accessToken, data, done)
|
||||
})
|
||||
|
||||
it('Should fail with a missing email', function (done) {
|
||||
const data = {
|
||||
username: 'ji',
|
||||
password: 'mysuperpassword'
|
||||
}
|
||||
|
||||
requestsUtils.makePostBodyRequest(server.url, path, server.accessToken, data, done)
|
||||
})
|
||||
|
||||
it('Should fail with an invalid email', function (done) {
|
||||
const data = {
|
||||
username: 'mysuperusernamewhichisverylong',
|
||||
email: 'testexample.com',
|
||||
password: 'mysuperpassword'
|
||||
}
|
||||
|
||||
@@ -119,6 +141,7 @@ describe('Test users API validators', function () {
|
||||
it('Should fail with a too small password', function (done) {
|
||||
const data = {
|
||||
username: 'myusername',
|
||||
email: 'test@example.com',
|
||||
password: 'bla'
|
||||
}
|
||||
|
||||
@@ -128,6 +151,7 @@ describe('Test users API validators', function () {
|
||||
it('Should fail with a too long password', function (done) {
|
||||
const data = {
|
||||
username: 'myusername',
|
||||
email: 'test@example.com',
|
||||
password: 'my super long password which is very very very very very very very very very very very very very very' +
|
||||
'very very very very very very very very very very very very very very very veryv very very very very' +
|
||||
'very very very very very very very very very very very very very very very very very very very very long'
|
||||
@@ -139,6 +163,7 @@ describe('Test users API validators', function () {
|
||||
it('Should fail with an non authenticated user', function (done) {
|
||||
const data = {
|
||||
username: 'myusername',
|
||||
email: 'test@example.com',
|
||||
password: 'my super password'
|
||||
}
|
||||
|
||||
@@ -148,6 +173,17 @@ describe('Test users API validators', function () {
|
||||
it('Should fail if we add a user with the same username', function (done) {
|
||||
const data = {
|
||||
username: 'user1',
|
||||
email: 'test@example.com',
|
||||
password: 'my super password'
|
||||
}
|
||||
|
||||
requestsUtils.makePostBodyRequest(server.url, path, server.accessToken, data, done, 409)
|
||||
})
|
||||
|
||||
it('Should fail if we add a user with the same email', function (done) {
|
||||
const data = {
|
||||
username: 'myusername',
|
||||
email: 'user1@example.com',
|
||||
password: 'my super password'
|
||||
}
|
||||
|
||||
@@ -157,6 +193,7 @@ describe('Test users API validators', function () {
|
||||
it('Should succeed with the correct params', function (done) {
|
||||
const data = {
|
||||
username: 'user2',
|
||||
email: 'test@example.com',
|
||||
password: 'my super password'
|
||||
}
|
||||
|
||||
@@ -166,6 +203,7 @@ describe('Test users API validators', function () {
|
||||
it('Should fail with a non admin user', function (done) {
|
||||
server.user = {
|
||||
username: 'user1',
|
||||
email: 'test@example.com',
|
||||
password: 'my super password'
|
||||
}
|
||||
|
||||
@@ -176,6 +214,7 @@ describe('Test users API validators', function () {
|
||||
|
||||
const data = {
|
||||
username: 'user3',
|
||||
email: 'test@example.com',
|
||||
password: 'my super password'
|
||||
}
|
||||
|
||||
|
||||
@@ -186,6 +186,7 @@ describe('Test users', function () {
|
||||
const user = res.body
|
||||
|
||||
expect(user.username).to.equal('user_1')
|
||||
expect(user.email).to.equal('user_1@example.com')
|
||||
expect(user.id).to.exist
|
||||
|
||||
done()
|
||||
@@ -216,9 +217,11 @@ describe('Test users', function () {
|
||||
|
||||
const user = users[0]
|
||||
expect(user.username).to.equal('user_1')
|
||||
expect(user.email).to.equal('user_1@example.com')
|
||||
|
||||
const rootUser = users[1]
|
||||
expect(rootUser.username).to.equal('root')
|
||||
expect(rootUser.email).to.equal('admin1@example.com')
|
||||
userId = user.id
|
||||
|
||||
done()
|
||||
@@ -238,6 +241,7 @@ describe('Test users', function () {
|
||||
|
||||
const user = users[0]
|
||||
expect(user.username).to.equal('root')
|
||||
expect(user.email).to.equal('admin1@example.com')
|
||||
|
||||
done()
|
||||
})
|
||||
@@ -256,6 +260,7 @@ describe('Test users', function () {
|
||||
|
||||
const user = users[0]
|
||||
expect(user.username).to.equal('user_1')
|
||||
expect(user.email).to.equal('user_1@example.com')
|
||||
|
||||
done()
|
||||
})
|
||||
@@ -274,6 +279,7 @@ describe('Test users', function () {
|
||||
|
||||
const user = users[0]
|
||||
expect(user.username).to.equal('user_1')
|
||||
expect(user.email).to.equal('user_1@example.com')
|
||||
|
||||
done()
|
||||
})
|
||||
@@ -291,7 +297,9 @@ describe('Test users', function () {
|
||||
expect(users.length).to.equal(2)
|
||||
|
||||
expect(users[0].username).to.equal('root')
|
||||
expect(users[0].email).to.equal('admin1@example.com')
|
||||
expect(users[1].username).to.equal('user_1')
|
||||
expect(users[1].email).to.equal('user_1@example.com')
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user