From: Chocobozzz Date: Thu, 7 Sep 2017 19:22:17 +0000 (+0200) Subject: urls: makefriends/quitfriends -> make-friends/quit-friends X-Git-Tag: v0.0.1-alpha~334 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=aa2e7f1501ce108e0c250538aba7046fddefc935;p=oweals%2Fpeertube.git urls: makefriends/quitfriends -> make-friends/quit-friends --- diff --git a/client/src/app/+admin/friends/shared/friend.service.ts b/client/src/app/+admin/friends/shared/friend.service.ts index 8bc0239ab..9b3ff04b1 100644 --- a/client/src/app/+admin/friends/shared/friend.service.ts +++ b/client/src/app/+admin/friends/shared/friend.service.ts @@ -26,13 +26,13 @@ export class FriendService { hosts: notEmptyHosts } - return this.authHttp.post(FriendService.BASE_FRIEND_URL + 'makefriends', body) + return this.authHttp.post(FriendService.BASE_FRIEND_URL + 'make-friends', body) .map(this.restExtractor.extractDataBool) .catch((res) => this.restExtractor.handleError(res)) } quitFriends () { - return this.authHttp.get(FriendService.BASE_FRIEND_URL + 'quitfriends') + return this.authHttp.get(FriendService.BASE_FRIEND_URL + 'quit-friends') .map(res => res.status) .catch((res) => this.restExtractor.handleError(res)) } 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('/', podsAddValidator, addPods ) -podsRouter.post('/makefriends', +podsRouter.post('/make-friends', authenticate, ensureIsAdmin, makeFriendsValidator, setBodyHostsPort, makeFriendsController ) -podsRouter.get('/quitfriends', +podsRouter.get('/quit-friends', authenticate, ensureIsAdmin, 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 () { it('Should fail without hosts', async function () { await request(server.url) - .post(path + '/makefriends') + .post(path + '/make-friends') .set('Authorization', 'Bearer ' + server.accessToken) .set('Accept', 'application/json') .expect(400) @@ -57,7 +57,7 @@ describe('Test pods API validators', function () { it('Should fail if hosts is not an array', async function () { await request(server.url) - .post(path + '/makefriends') + .post(path + '/make-friends') .send({ hosts: 'localhost:9002' }) .set('Authorization', 'Bearer ' + server.accessToken) .set('Accept', 'application/json') @@ -66,7 +66,7 @@ describe('Test pods API validators', function () { it('Should fail if the array is not composed by hosts', async function () { await request(server.url) - .post(path + '/makefriends') + .post(path + '/make-friends') .send({ hosts: [ 'localhost:9002', 'localhost:coucou' ] }) .set('Authorization', 'Bearer ' + server.accessToken) .set('Accept', 'application/json') @@ -75,7 +75,7 @@ describe('Test pods API validators', function () { it('Should fail if the array is composed with http schemes', async function () { await request(server.url) - .post(path + '/makefriends') + .post(path + '/make-friends') .send({ hosts: [ 'localhost:9002', 'http://localhost:9003' ] }) .set('Authorization', 'Bearer ' + server.accessToken) .set('Accept', 'application/json') @@ -84,7 +84,7 @@ describe('Test pods API validators', function () { it('Should fail if hosts are not unique', async function () { await request(server.url) - .post(path + '/makefriends') + .post(path + '/make-friends') .send({ urls: [ 'localhost:9002', 'localhost:9002' ] }) .set('Authorization', 'Bearer ' + server.accessToken) .set('Accept', 'application/json') @@ -93,16 +93,16 @@ describe('Test pods API validators', function () { it('Should fail with an invalid token', async function () { await request(server.url) - .post(path + '/makefriends') + .post(path + '/make-friends') .send(body) - .set('Authorization', 'Bearer faketoken') + .set('Authorization', 'Bearer fake_token') .set('Accept', 'application/json') .expect(401) }) it('Should fail if the user is not an administrator', async function () { await request(server.url) - .post(path + '/makefriends') + .post(path + '/make-friends') .send(body) .set('Authorization', 'Bearer ' + userAccessToken) .set('Accept', 'application/json') @@ -113,7 +113,7 @@ describe('Test pods API validators', function () { describe('When quitting friends', function () { it('Should fail with an invalid token', async function () { await request(server.url) - .get(path + '/quitfriends') + .get(path + '/quit-friends') .query({ start: 'hello' }) .set('Authorization', 'Bearer faketoken') .set('Accept', 'application/json') @@ -122,7 +122,7 @@ describe('Test pods API validators', function () { it('Should fail if the user is not an administrator', async function () { await request(server.url) - .get(path + '/quitfriends') + .get(path + '/quit-friends') .query({ start: 'hello' }) .set('Authorization', 'Bearer ' + userAccessToken) .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 'localhost:9003' ] } - const path = '/api/v1/pods/makefriends' + const path = '/api/v1/pods/make-friends' // The first pod make friend with the third const res = await request(url) @@ -54,7 +54,7 @@ async function makeFriends (url: string, accessToken: string, expectedStatus = 2 } async function quitFriends (url: string, accessToken: string, expectedStatus = 204) { - const path = '/api/v1/pods/quitfriends' + const path = '/api/v1/pods/quit-friends' // The first pod make friend with the third const res = await request(url)