diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-08 14:04:57 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-08 14:06:23 +0200 |
commit | 5b9c965d5aa747f29b081289f930ee215fdc23c8 (patch) | |
tree | 1c726117525230d74235e7fa986eb72e7376fb6c /server/tests/api/check-params | |
parent | 594d0c6a7c64b045c11508bb4e4b19b75b3fc557 (diff) | |
download | PeerTube-5b9c965d5aa747f29b081289f930ee215fdc23c8.tar.gz PeerTube-5b9c965d5aa747f29b081289f930ee215fdc23c8.tar.zst PeerTube-5b9c965d5aa747f29b081289f930ee215fdc23c8.zip |
Add ability to forbid followers
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r-- | server/tests/api/check-params/config.ts | 5 | ||||
-rw-r--r-- | server/tests/api/check-params/follows.ts | 40 |
2 files changed, 45 insertions, 0 deletions
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index 0b333e2f4..d117f26e6 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts | |||
@@ -87,6 +87,11 @@ describe('Test config API validators', function () { | |||
87 | enabled: false | 87 | enabled: false |
88 | } | 88 | } |
89 | } | 89 | } |
90 | }, | ||
91 | followers: { | ||
92 | instance: { | ||
93 | enabled: false | ||
94 | } | ||
90 | } | 95 | } |
91 | } | 96 | } |
92 | 97 | ||
diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts index 2ad1575a3..67fa43778 100644 --- a/server/tests/api/check-params/follows.ts +++ b/server/tests/api/check-params/follows.ts | |||
@@ -144,6 +144,46 @@ describe('Test server follows API validators', function () { | |||
144 | }) | 144 | }) |
145 | }) | 145 | }) |
146 | 146 | ||
147 | describe('When removing a follower', function () { | ||
148 | const path = '/api/v1/server/followers' | ||
149 | |||
150 | it('Should fail with an invalid token', async function () { | ||
151 | await makeDeleteRequest({ | ||
152 | url: server.url, | ||
153 | path: path + '/toto@localhost:9002', | ||
154 | token: 'fake_token', | ||
155 | statusCodeExpected: 401 | ||
156 | }) | ||
157 | }) | ||
158 | |||
159 | it('Should fail if the user is not an administrator', async function () { | ||
160 | await makeDeleteRequest({ | ||
161 | url: server.url, | ||
162 | path: path + '/toto@localhost:9002', | ||
163 | token: userAccessToken, | ||
164 | statusCodeExpected: 403 | ||
165 | }) | ||
166 | }) | ||
167 | |||
168 | it('Should fail with an invalid follower', async function () { | ||
169 | await makeDeleteRequest({ | ||
170 | url: server.url, | ||
171 | path: path + '/toto', | ||
172 | token: server.accessToken, | ||
173 | statusCodeExpected: 400 | ||
174 | }) | ||
175 | }) | ||
176 | |||
177 | it('Should fail with an unknown follower', async function () { | ||
178 | await makeDeleteRequest({ | ||
179 | url: server.url, | ||
180 | path: path + '/toto@localhost:9003', | ||
181 | token: server.accessToken, | ||
182 | statusCodeExpected: 404 | ||
183 | }) | ||
184 | }) | ||
185 | }) | ||
186 | |||
147 | describe('When removing following', function () { | 187 | describe('When removing following', function () { |
148 | const path = '/api/v1/server/following' | 188 | const path = '/api/v1/server/following' |
149 | 189 | ||