diff options
-rw-r--r-- | server/tests/api/notifications/moderation-notifications.ts | 2 | ||||
-rw-r--r-- | server/tests/api/search/search-activitypub-videos.ts | 2 | ||||
-rw-r--r-- | server/tests/api/videos/videos-overview.ts | 1 | ||||
-rw-r--r-- | shared/extra-utils/index.ts | 1 | ||||
-rw-r--r-- | shared/extra-utils/requests/requests.ts | 16 | ||||
-rw-r--r-- | shared/extra-utils/server/activitypub.ts | 15 |
6 files changed, 15 insertions, 22 deletions
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts index f77719c68..c4f63200a 100644 --- a/server/tests/api/notifications/moderation-notifications.ts +++ b/server/tests/api/notifications/moderation-notifications.ts | |||
@@ -235,7 +235,7 @@ describe('Test moderation notifications', function () { | |||
235 | const video = resVideo.body.video | 235 | const video = resVideo.body.video |
236 | 236 | ||
237 | { | 237 | { |
238 | const body = await servers[0].abusesCommand.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' }) | 238 | const body = await servers[0].abusesCommand.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' }) |
239 | abuseId = body.abuse.id | 239 | abuseId = body.abuse.id |
240 | } | 240 | } |
241 | 241 | ||
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index 1a5130ce9..7c6455258 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts | |||
@@ -72,7 +72,7 @@ describe('Test ActivityPub videos search', function () { | |||
72 | 72 | ||
73 | it('Should search a local video', async function () { | 73 | it('Should search a local video', async function () { |
74 | const search = 'http://localhost:' + servers[0].port + '/videos/watch/' + videoServer1UUID | 74 | const search = 'http://localhost:' + servers[0].port + '/videos/watch/' + videoServer1UUID |
75 | const body = await command.searchVideos({ search }) | 75 | const body = await command.searchVideos({ search }) |
76 | 76 | ||
77 | expect(body.total).to.equal(1) | 77 | expect(body.total).to.equal(1) |
78 | expect(body.data).to.be.an('array') | 78 | expect(body.data).to.be.an('array') |
diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts index c8e3df4bd..b3ab9e070 100644 --- a/server/tests/api/videos/videos-overview.ts +++ b/server/tests/api/videos/videos-overview.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { Response } from 'superagent' | ||
6 | import { | 5 | import { |
7 | addAccountToAccountBlocklist, | 6 | addAccountToAccountBlocklist, |
8 | cleanupTests, | 7 | cleanupTests, |
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts index 067e6fb65..9e0f6374a 100644 --- a/shared/extra-utils/index.ts +++ b/shared/extra-utils/index.ts | |||
@@ -13,7 +13,6 @@ export * from './requests/requests' | |||
13 | 13 | ||
14 | export * from './search' | 14 | export * from './search' |
15 | 15 | ||
16 | export * from './server/activitypub' | ||
17 | export * from './server/clients' | 16 | export * from './server/clients' |
18 | export * from './server/config' | 17 | export * from './server/config' |
19 | export * from './server/debug' | 18 | export * from './server/debug' |
diff --git a/shared/extra-utils/requests/requests.ts b/shared/extra-utils/requests/requests.ts index 8c26a3699..3fbaa31d6 100644 --- a/shared/extra-utils/requests/requests.ts +++ b/shared/extra-utils/requests/requests.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */ |
2 | 2 | ||
3 | import * as request from 'supertest' | ||
4 | import { buildAbsoluteFixturePath, root } from '../miscs/miscs' | ||
5 | import { isAbsolute, join } from 'path' | 3 | import { isAbsolute, join } from 'path' |
6 | import { URL } from 'url' | ||
7 | import { decode } from 'querystring' | 4 | import { decode } from 'querystring' |
5 | import * as request from 'supertest' | ||
6 | import { URL } from 'url' | ||
8 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | 7 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' |
8 | import { buildAbsoluteFixturePath, root } from '../miscs/miscs' | ||
9 | 9 | ||
10 | function get4KFileUrl () { | 10 | function get4KFileUrl () { |
11 | return 'https://download.cpy.re/peertube/4k_file.txt' | 11 | return 'https://download.cpy.re/peertube/4k_file.txt' |
@@ -154,6 +154,15 @@ function makeHTMLRequest (url: string, path: string) { | |||
154 | .expect(HttpStatusCode.OK_200) | 154 | .expect(HttpStatusCode.OK_200) |
155 | } | 155 | } |
156 | 156 | ||
157 | function makeActivityPubGetRequest (url: string, path: string, expectedStatus = HttpStatusCode.OK_200) { | ||
158 | return makeGetRequest({ | ||
159 | url, | ||
160 | path, | ||
161 | statusCodeExpected: expectedStatus, | ||
162 | accept: 'application/activity+json,text/html;q=0.9,\\*/\\*;q=0.8' | ||
163 | }) | ||
164 | } | ||
165 | |||
157 | function updateImageRequest (options: { | 166 | function updateImageRequest (options: { |
158 | url: string | 167 | url: string |
159 | path: string | 168 | path: string |
@@ -202,6 +211,7 @@ export { | |||
202 | makePutBodyRequest, | 211 | makePutBodyRequest, |
203 | makeDeleteRequest, | 212 | makeDeleteRequest, |
204 | makeRawRequest, | 213 | makeRawRequest, |
214 | makeActivityPubGetRequest, | ||
205 | unwrapBody, | 215 | unwrapBody, |
206 | unwrapText, | 216 | unwrapText, |
207 | updateImageRequest | 217 | updateImageRequest |
diff --git a/shared/extra-utils/server/activitypub.ts b/shared/extra-utils/server/activitypub.ts deleted file mode 100644 index cf967ed7d..000000000 --- a/shared/extra-utils/server/activitypub.ts +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | import * as request from 'supertest' | ||
2 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
3 | |||
4 | function makeActivityPubGetRequest (url: string, path: string, expectedStatus = HttpStatusCode.OK_200) { | ||
5 | return request(url) | ||
6 | .get(path) | ||
7 | .set('Accept', 'application/activity+json,text/html;q=0.9,\\*/\\*;q=0.8') | ||
8 | .expect(expectedStatus) | ||
9 | } | ||
10 | |||
11 | // --------------------------------------------------------------------------- | ||
12 | |||
13 | export { | ||
14 | makeActivityPubGetRequest | ||
15 | } | ||