aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-09-07 21:22:17 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-09-07 21:22:17 +0200
commitaa2e7f1501ce108e0c250538aba7046fddefc935 (patch)
treec1ef2d2f4b75bcacb54a4ac396bd668ec3b7168d /server
parent337c258e77b28bb39e61b7b88cbdaa18363b9461 (diff)
downloadPeerTube-aa2e7f1501ce108e0c250538aba7046fddefc935.tar.gz
PeerTube-aa2e7f1501ce108e0c250538aba7046fddefc935.tar.zst
PeerTube-aa2e7f1501ce108e0c250538aba7046fddefc935.zip
urls: makefriends/quitfriends -> make-friends/quit-friends
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/pods.ts4
-rw-r--r--server/tests/api/check-params/pods.ts20
-rw-r--r--server/tests/utils/pods.ts4
3 files changed, 14 insertions, 14 deletions
diff --git a/server/controllers/api/pods.ts b/server/controllers/api/pods.ts
index e1fa4b7e8..e1e8ff6ca 100644
--- a/server/controllers/api/pods.ts
+++ b/server/controllers/api/pods.ts
@@ -35,14 +35,14 @@ podsRouter.post('/',
35 podsAddValidator, 35 podsAddValidator,
36 addPods 36 addPods
37) 37)
38podsRouter.post('/makefriends', 38podsRouter.post('/make-friends',
39 authenticate, 39 authenticate,
40 ensureIsAdmin, 40 ensureIsAdmin,
41 makeFriendsValidator, 41 makeFriendsValidator,
42 setBodyHostsPort, 42 setBodyHostsPort,
43 makeFriendsController 43 makeFriendsController
44) 44)
45podsRouter.get('/quitfriends', 45podsRouter.get('/quit-friends',
46 authenticate, 46 authenticate,
47 ensureIsAdmin, 47 ensureIsAdmin,
48 quitFriendsController 48 quitFriendsController
diff --git a/server/tests/api/check-params/pods.ts b/server/tests/api/check-params/pods.ts
index 27c080931..a897e4dcd 100644
--- a/server/tests/api/check-params/pods.ts
+++ b/server/tests/api/check-params/pods.ts
@@ -49,7 +49,7 @@ describe('Test pods API validators', function () {
49 49
50 it('Should fail without hosts', async function () { 50 it('Should fail without hosts', async function () {
51 await request(server.url) 51 await request(server.url)
52 .post(path + '/makefriends') 52 .post(path + '/make-friends')
53 .set('Authorization', 'Bearer ' + server.accessToken) 53 .set('Authorization', 'Bearer ' + server.accessToken)
54 .set('Accept', 'application/json') 54 .set('Accept', 'application/json')
55 .expect(400) 55 .expect(400)
@@ -57,7 +57,7 @@ describe('Test pods API validators', function () {
57 57
58 it('Should fail if hosts is not an array', async function () { 58 it('Should fail if hosts is not an array', async function () {
59 await request(server.url) 59 await request(server.url)
60 .post(path + '/makefriends') 60 .post(path + '/make-friends')
61 .send({ hosts: 'localhost:9002' }) 61 .send({ hosts: 'localhost:9002' })
62 .set('Authorization', 'Bearer ' + server.accessToken) 62 .set('Authorization', 'Bearer ' + server.accessToken)
63 .set('Accept', 'application/json') 63 .set('Accept', 'application/json')
@@ -66,7 +66,7 @@ describe('Test pods API validators', function () {
66 66
67 it('Should fail if the array is not composed by hosts', async function () { 67 it('Should fail if the array is not composed by hosts', async function () {
68 await request(server.url) 68 await request(server.url)
69 .post(path + '/makefriends') 69 .post(path + '/make-friends')
70 .send({ hosts: [ 'localhost:9002', 'localhost:coucou' ] }) 70 .send({ hosts: [ 'localhost:9002', 'localhost:coucou' ] })
71 .set('Authorization', 'Bearer ' + server.accessToken) 71 .set('Authorization', 'Bearer ' + server.accessToken)
72 .set('Accept', 'application/json') 72 .set('Accept', 'application/json')
@@ -75,7 +75,7 @@ describe('Test pods API validators', function () {
75 75
76 it('Should fail if the array is composed with http schemes', async function () { 76 it('Should fail if the array is composed with http schemes', async function () {
77 await request(server.url) 77 await request(server.url)
78 .post(path + '/makefriends') 78 .post(path + '/make-friends')
79 .send({ hosts: [ 'localhost:9002', 'http://localhost:9003' ] }) 79 .send({ hosts: [ 'localhost:9002', 'http://localhost:9003' ] })
80 .set('Authorization', 'Bearer ' + server.accessToken) 80 .set('Authorization', 'Bearer ' + server.accessToken)
81 .set('Accept', 'application/json') 81 .set('Accept', 'application/json')
@@ -84,7 +84,7 @@ describe('Test pods API validators', function () {
84 84
85 it('Should fail if hosts are not unique', async function () { 85 it('Should fail if hosts are not unique', async function () {
86 await request(server.url) 86 await request(server.url)
87 .post(path + '/makefriends') 87 .post(path + '/make-friends')
88 .send({ urls: [ 'localhost:9002', 'localhost:9002' ] }) 88 .send({ urls: [ 'localhost:9002', 'localhost:9002' ] })
89 .set('Authorization', 'Bearer ' + server.accessToken) 89 .set('Authorization', 'Bearer ' + server.accessToken)
90 .set('Accept', 'application/json') 90 .set('Accept', 'application/json')
@@ -93,16 +93,16 @@ describe('Test pods API validators', function () {
93 93
94 it('Should fail with an invalid token', async function () { 94 it('Should fail with an invalid token', async function () {
95 await request(server.url) 95 await request(server.url)
96 .post(path + '/makefriends') 96 .post(path + '/make-friends')
97 .send(body) 97 .send(body)
98 .set('Authorization', 'Bearer faketoken') 98 .set('Authorization', 'Bearer fake_token')
99 .set('Accept', 'application/json') 99 .set('Accept', 'application/json')
100 .expect(401) 100 .expect(401)
101 }) 101 })
102 102
103 it('Should fail if the user is not an administrator', async function () { 103 it('Should fail if the user is not an administrator', async function () {
104 await request(server.url) 104 await request(server.url)
105 .post(path + '/makefriends') 105 .post(path + '/make-friends')
106 .send(body) 106 .send(body)
107 .set('Authorization', 'Bearer ' + userAccessToken) 107 .set('Authorization', 'Bearer ' + userAccessToken)
108 .set('Accept', 'application/json') 108 .set('Accept', 'application/json')
@@ -113,7 +113,7 @@ describe('Test pods API validators', function () {
113 describe('When quitting friends', function () { 113 describe('When quitting friends', function () {
114 it('Should fail with an invalid token', async function () { 114 it('Should fail with an invalid token', async function () {
115 await request(server.url) 115 await request(server.url)
116 .get(path + '/quitfriends') 116 .get(path + '/quit-friends')
117 .query({ start: 'hello' }) 117 .query({ start: 'hello' })
118 .set('Authorization', 'Bearer faketoken') 118 .set('Authorization', 'Bearer faketoken')
119 .set('Accept', 'application/json') 119 .set('Accept', 'application/json')
@@ -122,7 +122,7 @@ describe('Test pods API validators', function () {
122 122
123 it('Should fail if the user is not an administrator', async function () { 123 it('Should fail if the user is not an administrator', async function () {
124 await request(server.url) 124 await request(server.url)
125 .get(path + '/quitfriends') 125 .get(path + '/quit-friends')
126 .query({ start: 'hello' }) 126 .query({ start: 'hello' })
127 .set('Authorization', 'Bearer ' + userAccessToken) 127 .set('Authorization', 'Bearer ' + userAccessToken)
128 .set('Accept', 'application/json') 128 .set('Accept', 'application/json')
diff --git a/server/tests/utils/pods.ts b/server/tests/utils/pods.ts
index 0bea6db97..a86dd20d9 100644
--- a/server/tests/utils/pods.ts
+++ b/server/tests/utils/pods.ts
@@ -37,7 +37,7 @@ async function makeFriends (url: string, accessToken: string, expectedStatus = 2
37 'localhost:9003' 37 'localhost:9003'
38 ] 38 ]
39 } 39 }
40 const path = '/api/v1/pods/makefriends' 40 const path = '/api/v1/pods/make-friends'
41 41
42 // The first pod make friend with the third 42 // The first pod make friend with the third
43 const res = await request(url) 43 const res = await request(url)
@@ -54,7 +54,7 @@ async function makeFriends (url: string, accessToken: string, expectedStatus = 2
54} 54}
55 55
56async function quitFriends (url: string, accessToken: string, expectedStatus = 204) { 56async function quitFriends (url: string, accessToken: string, expectedStatus = 204) {
57 const path = '/api/v1/pods/quitfriends' 57 const path = '/api/v1/pods/quit-friends'
58 58
59 // The first pod make friend with the third 59 // The first pod make friend with the third
60 const res = await request(url) 60 const res = await request(url)