aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-21 10:34:18 +0200
committerChocobozzz <me@florianbigard.com>2018-08-27 09:41:54 +0200
commit99492dbc0d87ef54d0dab7d8d44f8d0de5722bdd (patch)
treee442f6cdf0cb622cb78f64d0d9de23bfb6deb951 /server/tests/api/check-params
parent8a19bee1a1ee39f973bb37429e4f73c3f2873cdb (diff)
downloadPeerTube-99492dbc0d87ef54d0dab7d8d44f8d0de5722bdd.tar.gz
PeerTube-99492dbc0d87ef54d0dab7d8d44f8d0de5722bdd.tar.zst
PeerTube-99492dbc0d87ef54d0dab7d8d44f8d0de5722bdd.zip
Add get subscription endpoint
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/user-subscriptions.ts59
1 files changed, 55 insertions, 4 deletions
diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.ts
index 628a74476..6a6dd9a6f 100644
--- a/server/tests/api/check-params/user-subscriptions.ts
+++ b/server/tests/api/check-params/user-subscriptions.ts
@@ -61,7 +61,7 @@ describe('Test user subscriptions API validators', function () {
61 }) 61 })
62 }) 62 })
63 63
64 it('Should success with the correct parameters', async function () { 64 it('Should succeed with the correct parameters', async function () {
65 await makeGetRequest({ 65 await makeGetRequest({
66 url: server.url, 66 url: server.url,
67 path, 67 path,
@@ -94,7 +94,7 @@ describe('Test user subscriptions API validators', function () {
94 }) 94 })
95 }) 95 })
96 96
97 it('Should success with the correct parameters', async function () { 97 it('Should succeed with the correct parameters', async function () {
98 await makeGetRequest({ 98 await makeGetRequest({
99 url: server.url, 99 url: server.url,
100 path, 100 path,
@@ -140,7 +140,7 @@ describe('Test user subscriptions API validators', function () {
140 }) 140 })
141 }) 141 })
142 142
143 it('Should success with the correct parameters', async function () { 143 it('Should succeed with the correct parameters', async function () {
144 await makePostBodyRequest({ 144 await makePostBodyRequest({
145 url: server.url, 145 url: server.url,
146 path, 146 path,
@@ -151,6 +151,57 @@ describe('Test user subscriptions API validators', function () {
151 }) 151 })
152 }) 152 })
153 153
154 describe('When getting a subscription', function () {
155 it('Should fail with a non authenticated user', async function () {
156 await makeGetRequest({
157 url: server.url,
158 path: path + '/user1_channel@localhost:9001',
159 statusCodeExpected: 401
160 })
161 })
162
163 it('Should fail with bad URIs', async function () {
164 await makeGetRequest({
165 url: server.url,
166 path: path + '/root',
167 token: server.accessToken,
168 statusCodeExpected: 400
169 })
170
171 await makeGetRequest({
172 url: server.url,
173 path: path + '/root@',
174 token: server.accessToken,
175 statusCodeExpected: 400
176 })
177
178 await makeGetRequest({
179 url: server.url,
180 path: path + '/root@hello@',
181 token: server.accessToken,
182 statusCodeExpected: 400
183 })
184 })
185
186 it('Should fail with an unknown subscription', async function () {
187 await makeGetRequest({
188 url: server.url,
189 path: path + '/root1@localhost:9001',
190 token: server.accessToken,
191 statusCodeExpected: 404
192 })
193 })
194
195 it('Should succeed with the correct parameters', async function () {
196 await makeGetRequest({
197 url: server.url,
198 path: path + '/user1_channel@localhost:9001',
199 token: server.accessToken,
200 statusCodeExpected: 200
201 })
202 })
203 })
204
154 describe('When removing a subscription', function () { 205 describe('When removing a subscription', function () {
155 it('Should fail with a non authenticated user', async function () { 206 it('Should fail with a non authenticated user', async function () {
156 await makeDeleteRequest({ 207 await makeDeleteRequest({
@@ -192,7 +243,7 @@ describe('Test user subscriptions API validators', function () {
192 }) 243 })
193 }) 244 })
194 245
195 it('Should success with the correct parameters', async function () { 246 it('Should succeed with the correct parameters', async function () {
196 await makeDeleteRequest({ 247 await makeDeleteRequest({
197 url: server.url, 248 url: server.url,
198 path: path + '/user1_channel@localhost:9001', 249 path: path + '/user1_channel@localhost:9001',