diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/check-params/videos-filter.ts | 29 | ||||
-rw-r--r-- | server/tests/api/videos/videos-filter.ts | 14 |
2 files changed, 31 insertions, 12 deletions
diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts index ec8654db2..bf8248b0e 100644 --- a/server/tests/api/check-params/videos-filter.ts +++ b/server/tests/api/check-params/videos-filter.ts | |||
@@ -78,28 +78,33 @@ describe('Test videos filters', function () { | |||
78 | await testEndpoints(server, server.accessToken, 'local', 200) | 78 | await testEndpoints(server, server.accessToken, 'local', 200) |
79 | }) | 79 | }) |
80 | 80 | ||
81 | it('Should fail to list all-local with a simple user', async function () { | 81 | it('Should fail to list all-local/all with a simple user', async function () { |
82 | await testEndpoints(server, userAccessToken, 'all-local', 401) | 82 | await testEndpoints(server, userAccessToken, 'all-local', 401) |
83 | await testEndpoints(server, userAccessToken, 'all', 401) | ||
83 | }) | 84 | }) |
84 | 85 | ||
85 | it('Should succeed to list all-local with a moderator', async function () { | 86 | it('Should succeed to list all-local/all with a moderator', async function () { |
86 | await testEndpoints(server, moderatorAccessToken, 'all-local', 200) | 87 | await testEndpoints(server, moderatorAccessToken, 'all-local', 200) |
88 | await testEndpoints(server, moderatorAccessToken, 'all', 200) | ||
87 | }) | 89 | }) |
88 | 90 | ||
89 | it('Should succeed to list all-local with an admin', async function () { | 91 | it('Should succeed to list all-local/all with an admin', async function () { |
90 | await testEndpoints(server, server.accessToken, 'all-local', 200) | 92 | await testEndpoints(server, server.accessToken, 'all-local', 200) |
93 | await testEndpoints(server, server.accessToken, 'all', 200) | ||
91 | }) | 94 | }) |
92 | 95 | ||
93 | // Because we cannot authenticate the user on the RSS endpoint | 96 | // Because we cannot authenticate the user on the RSS endpoint |
94 | it('Should fail on the feeds endpoint with the all-local filter', async function () { | 97 | it('Should fail on the feeds endpoint with the all-local/all filter', async function () { |
95 | await makeGetRequest({ | 98 | for (const filter of [ 'all', 'all-local' ]) { |
96 | url: server.url, | 99 | await makeGetRequest({ |
97 | path: '/feeds/videos.json', | 100 | url: server.url, |
98 | statusCodeExpected: 401, | 101 | path: '/feeds/videos.json', |
99 | query: { | 102 | statusCodeExpected: 401, |
100 | filter: 'all-local' | 103 | query: { |
101 | } | 104 | filter |
102 | }) | 105 | } |
106 | }) | ||
107 | } | ||
103 | }) | 108 | }) |
104 | 109 | ||
105 | it('Should succeed on the feeds endpoint with the local filter', async function () { | 110 | it('Should succeed on the feeds endpoint with the local filter', async function () { |
diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts index 95e12e43c..6b9a4b6d4 100644 --- a/server/tests/api/videos/videos-filter.ts +++ b/server/tests/api/videos/videos-filter.ts | |||
@@ -116,6 +116,20 @@ describe('Test videos filter validator', function () { | |||
116 | } | 116 | } |
117 | } | 117 | } |
118 | }) | 118 | }) |
119 | |||
120 | it('Should display all videos by the admin or the moderator', async function () { | ||
121 | for (const server of servers) { | ||
122 | for (const token of [ server.accessToken, server['moderatorAccessToken'] ]) { | ||
123 | |||
124 | const [ channelVideos, accountVideos, videos, searchVideos ] = await getVideosNames(server, token, 'all') | ||
125 | expect(channelVideos).to.have.lengthOf(3) | ||
126 | expect(accountVideos).to.have.lengthOf(3) | ||
127 | |||
128 | expect(videos).to.have.lengthOf(5) | ||
129 | expect(searchVideos).to.have.lengthOf(5) | ||
130 | } | ||
131 | } | ||
132 | }) | ||
119 | }) | 133 | }) |
120 | 134 | ||
121 | after(async function () { | 135 | after(async function () { |