From 982edf32ae436424e9b1ebf7f13696e4871ce202 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 28 Jul 2023 16:28:16 +0200 Subject: Remove deprecated video query filter --- .../api/check-params/videos-common-filters.ts | 73 --------------------- server/tests/api/videos/videos-common-filters.ts | 74 ---------------------- 2 files changed, 147 deletions(-) (limited to 'server/tests/api') diff --git a/server/tests/api/check-params/videos-common-filters.ts b/server/tests/api/check-params/videos-common-filters.ts index 3e44e2f67..603f7f777 100644 --- a/server/tests/api/check-params/videos-common-filters.ts +++ b/server/tests/api/check-params/videos-common-filters.ts @@ -35,79 +35,6 @@ describe('Test video filters validators', function () { moderatorAccessToken = await server.login.getAccessToken(moderator) }) - describe('When setting a deprecated video filter', function () { - - async function testEndpoints (token: string, filter: string, expectedStatus: HttpStatusCode) { - const paths = [ - '/api/v1/video-channels/root_channel/videos', - '/api/v1/accounts/root/videos', - '/api/v1/videos', - '/api/v1/search/videos', - '/api/v1/users/me/subscriptions/videos' - ] - - for (const path of paths) { - await makeGetRequest({ - url: server.url, - path, - token, - query: { - filter - }, - expectedStatus - }) - } - } - - it('Should fail with a bad filter', async function () { - await testEndpoints(server.accessToken, 'bad-filter', HttpStatusCode.BAD_REQUEST_400) - }) - - it('Should succeed with a good filter', async function () { - await testEndpoints(server.accessToken, 'local', HttpStatusCode.OK_200) - }) - - it('Should fail to list all-local/all with a simple user', async function () { - await testEndpoints(userAccessToken, 'all-local', HttpStatusCode.UNAUTHORIZED_401) - await testEndpoints(userAccessToken, 'all', HttpStatusCode.UNAUTHORIZED_401) - }) - - it('Should succeed to list all-local/all with a moderator', async function () { - await testEndpoints(moderatorAccessToken, 'all-local', HttpStatusCode.OK_200) - await testEndpoints(moderatorAccessToken, 'all', HttpStatusCode.OK_200) - }) - - it('Should succeed to list all-local/all with an admin', async function () { - await testEndpoints(server.accessToken, 'all-local', HttpStatusCode.OK_200) - await testEndpoints(server.accessToken, 'all', HttpStatusCode.OK_200) - }) - - // Because we cannot authenticate the user on the RSS endpoint - it('Should fail on the feeds endpoint with the all-local/all filter', async function () { - for (const filter of [ 'all', 'all-local' ]) { - await makeGetRequest({ - url: server.url, - path: '/feeds/videos.json', - expectedStatus: HttpStatusCode.UNAUTHORIZED_401, - query: { - filter - } - }) - } - }) - - it('Should succeed on the feeds endpoint with the local filter', async function () { - await makeGetRequest({ - url: server.url, - path: '/feeds/videos.json', - expectedStatus: HttpStatusCode.OK_200, - query: { - filter: 'local' - } - }) - }) - }) - describe('When setting video filters', function () { const validIncludes = [ diff --git a/server/tests/api/videos/videos-common-filters.ts b/server/tests/api/videos/videos-common-filters.ts index fac0f5dc5..48de7c537 100644 --- a/server/tests/api/videos/videos-common-filters.ts +++ b/server/tests/api/videos/videos-common-filters.ts @@ -74,80 +74,6 @@ describe('Test videos filter', function () { ] }) - describe('Check deprecated videos filter', function () { - - async function getVideosNames (options: { - server: PeerTubeServer - token: string - filter: string - skipSubscription?: boolean - expectedStatus?: HttpStatusCode - }) { - const { server, token, filter, skipSubscription = false, expectedStatus = HttpStatusCode.OK_200 } = options - - const videosResults: Video[][] = [] - - for (const path of paths) { - if (skipSubscription && path === subscriptionVideosPath) continue - - const res = await makeGetRequest({ - url: server.url, - path, - token, - query: { - sort: 'createdAt', - filter - }, - expectedStatus - }) - - videosResults.push(res.body.data.map(v => v.name)) - } - - return videosResults - } - - it('Should display local videos', async function () { - for (const server of servers) { - const namesResults = await getVideosNames({ server, token: server.accessToken, filter: 'local' }) - for (const names of namesResults) { - expect(names).to.have.lengthOf(1) - expect(names[0]).to.equal('public ' + server.serverNumber) - } - } - }) - - it('Should display all local videos by the admin or the moderator', async function () { - for (const server of servers) { - for (const token of [ server.accessToken, server['moderatorAccessToken'] ]) { - - const namesResults = await getVideosNames({ server, token, filter: 'all-local', skipSubscription: true }) - for (const names of namesResults) { - expect(names).to.have.lengthOf(3) - - expect(names[0]).to.equal('public ' + server.serverNumber) - expect(names[1]).to.equal('unlisted ' + server.serverNumber) - expect(names[2]).to.equal('private ' + server.serverNumber) - } - } - } - }) - - it('Should display all videos by the admin or the moderator', async function () { - for (const server of servers) { - for (const token of [ server.accessToken, server['moderatorAccessToken'] ]) { - - const [ channelVideos, accountVideos, videos, searchVideos ] = await getVideosNames({ server, token, filter: 'all' }) - expect(channelVideos).to.have.lengthOf(3) - expect(accountVideos).to.have.lengthOf(3) - - expect(videos).to.have.lengthOf(5) - expect(searchVideos).to.have.lengthOf(5) - } - } - }) - }) - describe('Check videos filters', function () { async function listVideos (options: { -- cgit v1.2.3