import { waitJobs } from './jobs'
import { makePostBodyRequest } from '../requests/requests'
import { ActivityPubActorType, FollowState } from '@shared/models'
+import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
function getFollowersListPaginationAndSort (options: {
url: string
.get(path)
.query(query)
.set('Accept', 'application/json')
- .expect(200)
+ .expect(HttpStatusCode.OK_200)
.expect('Content-Type', /json/)
}
-function acceptFollower (url: string, token: string, follower: string, statusCodeExpected = 204) {
+function acceptFollower (url: string, token: string, follower: string, statusCodeExpected = HttpStatusCode.NO_CONTENT_204) {
const path = '/api/v1/server/followers/' + follower + '/accept'
return makePostBodyRequest({
})
}
-function rejectFollower (url: string, token: string, follower: string, statusCodeExpected = 204) {
+function rejectFollower (url: string, token: string, follower: string, statusCodeExpected = HttpStatusCode.NO_CONTENT_204) {
const path = '/api/v1/server/followers/' + follower + '/reject'
return makePostBodyRequest({
.get(path)
.query(query)
.set('Accept', 'application/json')
- .expect(200)
+ .expect(HttpStatusCode.OK_200)
.expect('Content-Type', /json/)
}
-function follow (follower: string, following: string[], accessToken: string, expectedStatus = 204) {
+function follow (follower: string, following: string[], accessToken: string, expectedStatus = HttpStatusCode.NO_CONTENT_204) {
const path = '/api/v1/server/following'
const followingHosts = following.map(f => f.replace(/^http:\/\//, ''))
.expect(expectedStatus)
}
-async function unfollow (url: string, accessToken: string, target: ServerInfo, expectedStatus = 204) {
+async function unfollow (url: string, accessToken: string, target: ServerInfo, expectedStatus = HttpStatusCode.NO_CONTENT_204) {
const path = '/api/v1/server/following/' + target.host
return request(url)
.expect(expectedStatus)
}
-function removeFollower (url: string, accessToken: string, follower: ServerInfo, expectedStatus = 204) {
+function removeFollower (url: string, accessToken: string, follower: ServerInfo, expectedStatus = HttpStatusCode.NO_CONTENT_204) {
const path = '/api/v1/server/followers/peertube@' + follower.host
return request(url)