diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-17 14:20:43 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-17 14:27:16 +0100 |
commit | 6def7d34e6be805751b3f505b4e1436cc92fba35 (patch) | |
tree | c5667b09c461c4869510354c5aba377885f0fe6b /server/tests/api/users/user-subscriptions.ts | |
parent | f304a1580b5ce7b6c5f9e25cd3ddc63ca8d8c6a1 (diff) | |
download | PeerTube-6def7d34e6be805751b3f505b4e1436cc92fba35.tar.gz PeerTube-6def7d34e6be805751b3f505b4e1436cc92fba35.tar.zst PeerTube-6def7d34e6be805751b3f505b4e1436cc92fba35.zip |
Fix migrations
Diffstat (limited to 'server/tests/api/users/user-subscriptions.ts')
-rw-r--r-- | server/tests/api/users/user-subscriptions.ts | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts index 190a19c38..57cca6ad4 100644 --- a/server/tests/api/users/user-subscriptions.ts +++ b/server/tests/api/users/user-subscriptions.ts | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { VideoPrivacy } from '@shared/models' | ||
5 | import { | 6 | import { |
6 | cleanupTests, | 7 | cleanupTests, |
7 | createMultipleServers, | 8 | createMultipleServers, |
@@ -32,20 +33,18 @@ describe('Test users subscriptions', function () { | |||
32 | // Server 1 and server 2 follow each other | 33 | // Server 1 and server 2 follow each other |
33 | await doubleFollow(servers[0], servers[1]) | 34 | await doubleFollow(servers[0], servers[1]) |
34 | 35 | ||
35 | { | 36 | for (const server of servers) { |
36 | for (const server of servers) { | 37 | const user = { username: 'user' + server.serverNumber, password: 'password' } |
37 | const user = { username: 'user' + server.serverNumber, password: 'password' } | 38 | await server.users.create({ username: user.username, password: user.password }) |
38 | await server.users.create({ username: user.username, password: user.password }) | ||
39 | 39 | ||
40 | const accessToken = await server.login.getAccessToken(user) | 40 | const accessToken = await server.login.getAccessToken(user) |
41 | users.push({ accessToken }) | 41 | users.push({ accessToken }) |
42 | 42 | ||
43 | const videoName1 = 'video 1-' + server.serverNumber | 43 | const videoName1 = 'video 1-' + server.serverNumber |
44 | await server.videos.upload({ token: accessToken, attributes: { name: videoName1 } }) | 44 | await server.videos.upload({ token: accessToken, attributes: { name: videoName1 } }) |
45 | 45 | ||
46 | const videoName2 = 'video 2-' + server.serverNumber | 46 | const videoName2 = 'video 2-' + server.serverNumber |
47 | await server.videos.upload({ token: accessToken, attributes: { name: videoName2 } }) | 47 | await server.videos.upload({ token: accessToken, attributes: { name: videoName2 } }) |
48 | } | ||
49 | } | 48 | } |
50 | 49 | ||
51 | await waitJobs(servers) | 50 | await waitJobs(servers) |
@@ -540,6 +539,40 @@ describe('Test users subscriptions', function () { | |||
540 | } | 539 | } |
541 | }) | 540 | }) |
542 | 541 | ||
542 | it('Should update video as internal and not see from remote server', async function () { | ||
543 | this.timeout(30000) | ||
544 | |||
545 | await servers[2].videos.update({ id: video3UUID, attributes: { name: 'internal', privacy: VideoPrivacy.INTERNAL } }) | ||
546 | await waitJobs(servers) | ||
547 | |||
548 | { | ||
549 | const { data } = await command.listVideos({ token: users[0].accessToken }) | ||
550 | expect(data.find(v => v.name === 'internal')).to.not.exist | ||
551 | } | ||
552 | }) | ||
553 | |||
554 | it('Should see internal from local user', async function () { | ||
555 | const { data } = await servers[2].subscriptions.listVideos({ token: servers[2].accessToken }) | ||
556 | expect(data.find(v => v.name === 'internal')).to.exist | ||
557 | }) | ||
558 | |||
559 | it('Should update video as private and not see from anyone server', async function () { | ||
560 | this.timeout(30000) | ||
561 | |||
562 | await servers[2].videos.update({ id: video3UUID, attributes: { name: 'private', privacy: VideoPrivacy.PRIVATE } }) | ||
563 | await waitJobs(servers) | ||
564 | |||
565 | { | ||
566 | const { data } = await command.listVideos({ token: users[0].accessToken }) | ||
567 | expect(data.find(v => v.name === 'private')).to.not.exist | ||
568 | } | ||
569 | |||
570 | { | ||
571 | const { data } = await servers[2].subscriptions.listVideos({ token: servers[2].accessToken }) | ||
572 | expect(data.find(v => v.name === 'private')).to.not.exist | ||
573 | } | ||
574 | }) | ||
575 | |||
543 | after(async function () { | 576 | after(async function () { |
544 | await cleanupTests(servers) | 577 | await cleanupTests(servers) |
545 | }) | 578 | }) |