Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Move AP request in requests file

Chocobozzz2d1ad5b96063
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index f77719c683..c4f63200a4 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 () {
const video = resVideo.body.video
{
- const body = await servers[0].abusesCommand.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' })
+ const body = await servers[0].abusesCommand.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' })
abuseId = body.abuse.id
}
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts
index 1a5130ce91..7c64552581 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 () {
it('Should search a local video', async function () {
const search = 'http://localhost:' + servers[0].port + '/videos/watch/' + videoServer1UUID
- const body = await command.searchVideos({ search })
+ const body = await command.searchVideos({ search })
expect(body.total).to.equal(1)
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 c8e3df4bd6..b3ab9e070e 100644
--- a/server/tests/api/videos/videos-overview.ts
+++ b/server/tests/api/videos/videos-overview.ts
@@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
-import { Response } from 'superagent'
import {
addAccountToAccountBlocklist,
cleanupTests,
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts
index 067e6fb656..9e0f6374ad 100644
--- a/shared/extra-utils/index.ts
+++ b/shared/extra-utils/index.ts
@@ -13,7 +13,6 @@ export * from './requests/requests'
export * from './search'
-export * from './server/activitypub'
export * from './server/clients'
export * from './server/config'
export * from './server/debug'
diff --git a/shared/extra-utils/requests/requests.ts b/shared/extra-utils/requests/requests.ts
index 8c26a3699f..3fbaa31d61 100644
--- a/shared/extra-utils/requests/requests.ts
+++ b/shared/extra-utils/requests/requests.ts
@@ -1,11 +1,11 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
-import * as request from 'supertest'
-import { buildAbsoluteFixturePath, root } from '../miscs/miscs'
import { isAbsolute, join } from 'path'
-import { URL } from 'url'
import { decode } from 'querystring'
+import * as request from 'supertest'
+import { URL } from 'url'
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
+import { buildAbsoluteFixturePath, root } from '../miscs/miscs'
function get4KFileUrl () {
return 'https://download.cpy.re/peertube/4k_file.txt'
@@ -154,6 +154,15 @@ function makeHTMLRequest (url: string, path: string) {
.expect(HttpStatusCode.OK_200)
}
+function makeActivityPubGetRequest (url: string, path: string, expectedStatus = HttpStatusCode.OK_200) {
+ return makeGetRequest({
+ url,
+ path,
+ statusCodeExpected: expectedStatus,
+ accept: 'application/activity+json,text/html;q=0.9,\\*/\\*;q=0.8'
+ })
+}
+
function updateImageRequest (options: {
url: string
path: string
@@ -202,6 +211,7 @@ export {
makePutBodyRequest,
makeDeleteRequest,
makeRawRequest,
+ makeActivityPubGetRequest,
unwrapBody,
unwrapText,
updateImageRequest
diff --git a/shared/extra-utils/server/activitypub.ts b/shared/extra-utils/server/activitypub.ts
deleted file mode 100644
index cf967ed7d0..0000000000
--- a/shared/extra-utils/server/activitypub.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import * as request from 'supertest'
-import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
-
-function makeActivityPubGetRequest (url: string, path: string, expectedStatus = HttpStatusCode.OK_200) {
- return request(url)
- .get(path)
- .set('Accept', 'application/activity+json,text/html;q=0.9,\\*/\\*;q=0.8')
- .expect(expectedStatus)
-}
-
-// ---------------------------------------------------------------------------
-
-export {
- makeActivityPubGetRequest
-}