From aa2e7f1501ce108e0c250538aba7046fddefc935 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 7 Sep 2017 21:22:17 +0200 Subject: urls: makefriends/quitfriends -> make-friends/quit-friends --- server/controllers/api/pods.ts | 4 ++-- server/tests/api/check-params/pods.ts | 20 ++++++++++---------- server/tests/utils/pods.ts | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'server') 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) -- cgit v1.2.3