aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-20 16:59:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-20 17:11:38 +0200
commit1e2564d3927ce4ca4ca9a09930da6da7ebb4e9a1 (patch)
tree1a2601d63152da4906335c6116ba5f1e8992af33 /server/tests/api/check-params.js
parente861452fb26553177ad4e32bfb18b4fd8a5b1816 (diff)
downloadPeerTube-1e2564d3927ce4ca4ca9a09930da6da7ebb4e9a1.tar.gz
PeerTube-1e2564d3927ce4ca4ca9a09930da6da7ebb4e9a1.tar.zst
PeerTube-1e2564d3927ce4ca4ca9a09930da6da7ebb4e9a1.zip
Server: make friends urls come from the request instead of the
configuration file
Diffstat (limited to 'server/tests/api/check-params.js')
-rw-r--r--server/tests/api/check-params.js38
1 files changed, 34 insertions, 4 deletions
diff --git a/server/tests/api/check-params.js b/server/tests/api/check-params.js
index fc8b0a42a..ec666417c 100644
--- a/server/tests/api/check-params.js
+++ b/server/tests/api/check-params.js
@@ -108,10 +108,40 @@ describe('Test parameters validator', function () {
108 }) 108 })
109 109
110 describe('When making friends', function () { 110 describe('When making friends', function () {
111 const body = {
112 urls: [ 'http://localhost:9002' ]
113 }
114
115 it('Should fail without urls', function (done) {
116 request(server.url)
117 .post(path + '/makefriends')
118 .set('Authorization', 'Bearer faketoken')
119 .set('Accept', 'application/json')
120 .expect(401, done)
121 })
122
123 it('Should fail with urls is not an array', function (done) {
124 request(server.url)
125 .post(path + '/makefriends')
126 .send({ urls: 'http://localhost:9002' })
127 .set('Authorization', 'Bearer faketoken')
128 .set('Accept', 'application/json')
129 .expect(401, done)
130 })
131
132 it('Should fail if the array is not composed by urls', function (done) {
133 request(server.url)
134 .post(path + '/makefriends')
135 .send({ urls: [ 'http://localhost:9002', 'localhost:coucou' ] })
136 .set('Authorization', 'Bearer faketoken')
137 .set('Accept', 'application/json')
138 .expect(401, done)
139 })
140
111 it('Should fail with a invalid token', function (done) { 141 it('Should fail with a invalid token', function (done) {
112 request(server.url) 142 request(server.url)
113 .get(path + '/makefriends') 143 .post(path + '/makefriends')
114 .query({ start: 'hello' }) 144 .send(body)
115 .set('Authorization', 'Bearer faketoken') 145 .set('Authorization', 'Bearer faketoken')
116 .set('Accept', 'application/json') 146 .set('Accept', 'application/json')
117 .expect(401, done) 147 .expect(401, done)
@@ -119,8 +149,8 @@ describe('Test parameters validator', function () {
119 149
120 it('Should fail if the user is not an administrator', function (done) { 150 it('Should fail if the user is not an administrator', function (done) {
121 request(server.url) 151 request(server.url)
122 .get(path + '/makefriends') 152 .post(path + '/makefriends')
123 .query({ start: 'hello' }) 153 .send(body)
124 .set('Authorization', 'Bearer ' + userAccessToken) 154 .set('Authorization', 'Bearer ' + userAccessToken)
125 .set('Accept', 'application/json') 155 .set('Accept', 'application/json')
126 .expect(403, done) 156 .expect(403, done)