aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/feeds/feeds.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 16:40:49 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit2c27e70471120c92e0bc8c8114141fbb31ff98ac (patch)
treef52d89adc0351168fd1d89cbc07652e1408caaf2 /server/tests/feeds/feeds.ts
parent5f8bd4cbb178290da7d8f81e996f19f0eccc8e4c (diff)
downloadPeerTube-2c27e70471120c92e0bc8c8114141fbb31ff98ac.tar.gz
PeerTube-2c27e70471120c92e0bc8c8114141fbb31ff98ac.tar.zst
PeerTube-2c27e70471120c92e0bc8c8114141fbb31ff98ac.zip
Introduce subscriptions command
Diffstat (limited to 'server/tests/feeds/feeds.ts')
-rw-r--r--server/tests/feeds/feeds.ts24
1 files changed, 11 insertions, 13 deletions
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts
index 17efc666d..6ee22340b 100644
--- a/server/tests/feeds/feeds.ts
+++ b/server/tests/feeds/feeds.ts
@@ -5,7 +5,6 @@ import * as chai from 'chai'
5import * as xmlParser from 'fast-xml-parser' 5import * as xmlParser from 'fast-xml-parser'
6import { HttpStatusCode } from '@shared/core-utils' 6import { HttpStatusCode } from '@shared/core-utils'
7import { 7import {
8 addUserSubscription,
9 addVideoCommentThread, 8 addVideoCommentThread,
10 cleanupTests, 9 cleanupTests,
11 createUser, 10 createUser,
@@ -14,7 +13,6 @@ import {
14 flushAndRunServer, 13 flushAndRunServer,
15 getMyUserInformation, 14 getMyUserInformation,
16 getUserScopedTokens, 15 getUserScopedTokens,
17 listUserSubscriptionVideos,
18 renewUserScopedTokens, 16 renewUserScopedTokens,
19 ServerInfo, 17 ServerInfo,
20 setAccessTokensToServers, 18 setAccessTokensToServers,
@@ -319,8 +317,8 @@ describe('Test syndication feeds', () => {
319 } 317 }
320 318
321 { 319 {
322 const res = await listUserSubscriptionVideos(servers[0].url, feeduserAccessToken) 320 const body = await servers[0].subscriptionsCommand.listVideos({ token: feeduserAccessToken })
323 expect(res.body.total).to.equal(0) 321 expect(body.total).to.equal(0)
324 322
325 const query = { accountId: feeduserAccountId, token: feeduserFeedToken } 323 const query = { accountId: feeduserAccountId, token: feeduserFeedToken }
326 const json = await servers[0].feedCommand.getJSON({ feed: 'subscriptions', query }) 324 const json = await servers[0].feedCommand.getJSON({ feed: 'subscriptions', query })
@@ -340,8 +338,8 @@ describe('Test syndication feeds', () => {
340 }) 338 })
341 339
342 it('Should list no videos for a user with videos but no subscriptions', async function () { 340 it('Should list no videos for a user with videos but no subscriptions', async function () {
343 const res = await listUserSubscriptionVideos(servers[0].url, userAccessToken) 341 const body = await servers[0].subscriptionsCommand.listVideos({ token: userAccessToken })
344 expect(res.body.total).to.equal(0) 342 expect(body.total).to.equal(0)
345 343
346 const query = { accountId: userAccountId, token: userFeedToken } 344 const query = { accountId: userAccountId, token: userFeedToken }
347 const json = await servers[0].feedCommand.getJSON({ feed: 'subscriptions', query }) 345 const json = await servers[0].feedCommand.getJSON({ feed: 'subscriptions', query })
@@ -352,13 +350,13 @@ describe('Test syndication feeds', () => {
352 it('Should list self videos for a user with a subscription to themselves', async function () { 350 it('Should list self videos for a user with a subscription to themselves', async function () {
353 this.timeout(30000) 351 this.timeout(30000)
354 352
355 await addUserSubscription(servers[0].url, userAccessToken, 'john_channel@localhost:' + servers[0].port) 353 await servers[0].subscriptionsCommand.add({ token: userAccessToken, targetUri: 'john_channel@localhost:' + servers[0].port })
356 await waitJobs(servers) 354 await waitJobs(servers)
357 355
358 { 356 {
359 const res = await listUserSubscriptionVideos(servers[0].url, userAccessToken) 357 const body = await servers[0].subscriptionsCommand.listVideos({ token: userAccessToken })
360 expect(res.body.total).to.equal(1) 358 expect(body.total).to.equal(1)
361 expect(res.body.data[0].name).to.equal('user video') 359 expect(body.data[0].name).to.equal('user video')
362 360
363 const query = { accountId: userAccountId, token: userFeedToken, version: 1 } 361 const query = { accountId: userAccountId, token: userFeedToken, version: 1 }
364 const json = await servers[0].feedCommand.getJSON({ feed: 'subscriptions', query }) 362 const json = await servers[0].feedCommand.getJSON({ feed: 'subscriptions', query })
@@ -370,12 +368,12 @@ describe('Test syndication feeds', () => {
370 it('Should list videos of a user\'s subscription', async function () { 368 it('Should list videos of a user\'s subscription', async function () {
371 this.timeout(30000) 369 this.timeout(30000)
372 370
373 await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:' + servers[0].port) 371 await servers[0].subscriptionsCommand.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[0].port })
374 await waitJobs(servers) 372 await waitJobs(servers)
375 373
376 { 374 {
377 const res = await listUserSubscriptionVideos(servers[0].url, userAccessToken) 375 const body = await servers[0].subscriptionsCommand.listVideos({ token: userAccessToken })
378 expect(res.body.total).to.equal(2, "there should be 2 videos part of the subscription") 376 expect(body.total).to.equal(2, "there should be 2 videos part of the subscription")
379 377
380 const query = { accountId: userAccountId, token: userFeedToken, version: 2 } 378 const query = { accountId: userAccountId, token: userFeedToken, version: 2 }
381 const json = await servers[0].feedCommand.getJSON({ feed: 'subscriptions', query }) 379 const json = await servers[0].feedCommand.getJSON({ feed: 'subscriptions', query })