diff options
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 | ||