1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

First version with PostgreSQL

This commit is contained in:
Chocobozzz 2016-12-11 21:50:51 +01:00
parent 108626609e
commit feb4bdfd9b
68 changed files with 1171 additions and 730 deletions

View file

@ -465,7 +465,7 @@ describe('Test parameters validator', function () {
it('Should return 404 with an incorrect video', function (done) {
request(server.url)
.get(path + '123456789012345678901234')
.get(path + '4da6fde3-88f7-4d16-b119-108df5630b06')
.set('Accept', 'application/json')
.expect(404, done)
})
@ -490,7 +490,7 @@ describe('Test parameters validator', function () {
it('Should fail with a video which does not exist', function (done) {
request(server.url)
.delete(path + '123456789012345678901234')
.delete(path + '4da6fde3-88f7-4d16-b119-108df5630b06')
.set('Authorization', 'Bearer ' + server.accessToken)
.expect(404, done)
})
@ -711,7 +711,7 @@ describe('Test parameters validator', function () {
it('Should return 404 with a non existing id', function (done) {
request(server.url)
.delete(path + '579f982228c99c221d8092b8')
.delete(path + '45')
.set('Authorization', 'Bearer ' + server.accessToken)
.expect(404, done)
})

View file

@ -97,7 +97,7 @@ describe('Test basic friends', function () {
const pod = result[0]
expect(pod.host).to.equal(servers[2].host)
expect(pod.score).to.equal(20)
expect(miscsUtils.dateIsValid(pod.createdDate)).to.be.true
expect(miscsUtils.dateIsValid(pod.createdAt)).to.be.true
next()
})
@ -114,7 +114,7 @@ describe('Test basic friends', function () {
const pod = result[0]
expect(pod.host).to.equal(servers[1].host)
expect(pod.score).to.equal(20)
expect(miscsUtils.dateIsValid(pod.createdDate)).to.be.true
expect(miscsUtils.dateIsValid(pod.createdAt)).to.be.true
next()
})

View file

@ -104,7 +104,7 @@ describe('Test multiple pods', function () {
expect(video.magnetUri).to.exist
expect(video.duration).to.equal(10)
expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ])
expect(miscsUtils.dateIsValid(video.createdDate)).to.be.true
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
expect(video.author).to.equal('root')
if (server.url !== 'http://localhost:9001') {
@ -166,7 +166,7 @@ describe('Test multiple pods', function () {
expect(video.magnetUri).to.exist
expect(video.duration).to.equal(5)
expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ])
expect(miscsUtils.dateIsValid(video.createdDate)).to.be.true
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
expect(video.author).to.equal('root')
if (server.url !== 'http://localhost:9002') {
@ -246,7 +246,7 @@ describe('Test multiple pods', function () {
expect(video1.duration).to.equal(5)
expect(video1.tags).to.deep.equal([ 'tag1p3' ])
expect(video1.author).to.equal('root')
expect(miscsUtils.dateIsValid(video1.createdDate)).to.be.true
expect(miscsUtils.dateIsValid(video1.createdAt)).to.be.true
expect(video2.name).to.equal('my super name for pod 3-2')
expect(video2.description).to.equal('my super description for pod 3-2')
@ -255,7 +255,7 @@ describe('Test multiple pods', function () {
expect(video2.duration).to.equal(5)
expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ])
expect(video2.author).to.equal('root')
expect(miscsUtils.dateIsValid(video2.createdDate)).to.be.true
expect(miscsUtils.dateIsValid(video2.createdAt)).to.be.true
if (server.url !== 'http://localhost:9003') {
expect(video1.isLocal).to.be.false

View file

@ -69,7 +69,7 @@ describe('Test requests stats', function () {
})
})
it('Should have the correct request', function (done) {
it('Should have the correct total request', function (done) {
this.timeout(15000)
const server = servers[0]
@ -83,11 +83,7 @@ describe('Test requests stats', function () {
if (err) throw err
const body = res.body
expect(body.requests).to.have.lengthOf(1)
const request = body.requests[0]
expect(request.to).to.have.lengthOf(1)
expect(request.request.type).to.equal('add')
expect(body.totalRequests).to.equal(1)
// Wait one cycle
setTimeout(done, 10000)
@ -95,27 +91,6 @@ describe('Test requests stats', function () {
})
})
it('Should have the correct requests', function (done) {
const server = servers[0]
uploadVideo(server, function (err) {
if (err) throw err
getRequestsStats(server, function (err, res) {
if (err) throw err
const body = res.body
expect(body.requests).to.have.lengthOf(2)
const request = body.requests[1]
expect(request.to).to.have.lengthOf(1)
expect(request.request.type).to.equal('add')
done()
})
})
})
after(function (done) {
process.kill(-servers[0].app.pid)

View file

@ -82,7 +82,7 @@ describe('Test a single pod', function () {
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(miscsUtils.dateIsValid(video.createdDate)).to.be.true
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
if (err) throw err
@ -116,7 +116,7 @@ describe('Test a single pod', function () {
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(miscsUtils.dateIsValid(video.createdDate)).to.be.true
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
if (err) throw err
@ -142,7 +142,7 @@ describe('Test a single pod', function () {
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(miscsUtils.dateIsValid(video.createdDate)).to.be.true
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
if (err) throw err
@ -154,7 +154,7 @@ describe('Test a single pod', function () {
})
it('Should search the video by podHost', function (done) {
videosUtils.searchVideo(server.url, '9001', 'podHost', function (err, res) {
videosUtils.searchVideo(server.url, '9001', 'host', function (err, res) {
if (err) throw err
expect(res.body.total).to.equal(1)
@ -168,7 +168,7 @@ describe('Test a single pod', function () {
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(miscsUtils.dateIsValid(video.createdDate)).to.be.true
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
if (err) throw err
@ -194,7 +194,7 @@ describe('Test a single pod', function () {
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(miscsUtils.dateIsValid(video.createdDate)).to.be.true
expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
videosUtils.testVideoImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
if (err) throw err
@ -425,7 +425,7 @@ describe('Test a single pod', function () {
})
it('Should search all the 9001 port videos', function (done) {
videosUtils.searchVideoWithPagination(server.url, '9001', 'podHost', 0, 15, function (err, res) {
videosUtils.searchVideoWithPagination(server.url, '9001', 'host', 0, 15, function (err, res) {
if (err) throw err
const videos = res.body.data
@ -437,7 +437,7 @@ describe('Test a single pod', function () {
})
it('Should search all the localhost videos', function (done) {
videosUtils.searchVideoWithPagination(server.url, 'localhost', 'podHost', 0, 15, function (err, res) {
videosUtils.searchVideoWithPagination(server.url, 'localhost', 'host', 0, 15, function (err, res) {
if (err) throw err
const videos = res.body.data

View file

@ -261,8 +261,8 @@ describe('Test users', function () {
})
})
it('Should list only the second user by createdDate desc', function (done) {
usersUtils.getUsersListPaginationAndSort(server.url, 0, 1, '-createdDate', function (err, res) {
it('Should list only the second user by createdAt desc', function (done) {
usersUtils.getUsersListPaginationAndSort(server.url, 0, 1, '-createdAt', function (err, res) {
if (err) throw err
const result = res.body
@ -279,8 +279,8 @@ describe('Test users', function () {
})
})
it('Should list all the users by createdDate asc', function (done) {
usersUtils.getUsersListPaginationAndSort(server.url, 0, 2, 'createdDate', function (err, res) {
it('Should list all the users by createdAt asc', function (done) {
usersUtils.getUsersListPaginationAndSort(server.url, 0, 2, 'createdAt', function (err, res) {
if (err) throw err
const result = res.body