mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-11-29 12:04:02 -06:00
Move AP request in requests file
This commit is contained in:
parent
af971e06c6
commit
2d1ad5b960
@ -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
|
||||
}
|
||||
|
||||
|
@ -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')
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
import 'mocha'
|
||||
import * as chai from 'chai'
|
||||
import { Response } from 'superagent'
|
||||
import {
|
||||
addAccountToAccountBlocklist,
|
||||
cleanupTests,
|
||||
|
@ -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'
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user