1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

replace numbers with typed http status codes (#3409)

This commit is contained in:
Rigel Kent 2020-12-07 14:32:36 +01:00 committed by GitHub
parent adc1f09c0d
commit 2d53be0267
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
149 changed files with 1721 additions and 1108 deletions

View file

@ -13,6 +13,7 @@ import {
uploadVideo
} from '../../shared/extra-utils'
import { VideoPrivacy } from '../../shared/models/videos'
import { HttpStatusCode } from '@shared/core-utils'
const expect = chai.expect
@ -32,7 +33,7 @@ describe('Test misc endpoints', function () {
const res = await makeGetRequest({
url: server.url,
path: '/.well-known/security.txt',
statusCodeExpected: 200
statusCodeExpected: HttpStatusCode.OK_200
})
expect(res.text).to.contain('security issue')
@ -42,7 +43,7 @@ describe('Test misc endpoints', function () {
const res = await makeGetRequest({
url: server.url,
path: '/.well-known/nodeinfo',
statusCodeExpected: 200
statusCodeExpected: HttpStatusCode.OK_200
})
expect(res.body.links).to.be.an('array')
@ -54,7 +55,7 @@ describe('Test misc endpoints', function () {
const res = await makeGetRequest({
url: server.url,
path: '/.well-known/dnt-policy.txt',
statusCodeExpected: 200
statusCodeExpected: HttpStatusCode.OK_200
})
expect(res.text).to.contain('http://www.w3.org/TR/tracking-dnt')
@ -64,7 +65,7 @@ describe('Test misc endpoints', function () {
const res = await makeGetRequest({
url: server.url,
path: '/.well-known/dnt',
statusCodeExpected: 200
statusCodeExpected: HttpStatusCode.OK_200
})
expect(res.body.tracking).to.equal('N')
@ -74,7 +75,7 @@ describe('Test misc endpoints', function () {
const res = await makeGetRequest({
url: server.url,
path: '/.well-known/change-password',
statusCodeExpected: 302
statusCodeExpected: HttpStatusCode.FOUND_302
})
expect(res.header.location).to.equal('/my-account/settings')
@ -87,7 +88,7 @@ describe('Test misc endpoints', function () {
const res = await makeGetRequest({
url: server.url,
path: '/robots.txt',
statusCodeExpected: 200
statusCodeExpected: HttpStatusCode.OK_200
})
expect(res.text).to.contain('User-agent')
@ -97,7 +98,7 @@ describe('Test misc endpoints', function () {
await makeGetRequest({
url: server.url,
path: '/security.txt',
statusCodeExpected: 301
statusCodeExpected: HttpStatusCode.MOVED_PERMANENTLY_301
})
})
@ -105,7 +106,7 @@ describe('Test misc endpoints', function () {
const res = await makeGetRequest({
url: server.url,
path: '/nodeinfo/2.0.json',
statusCodeExpected: 200
statusCodeExpected: HttpStatusCode.OK_200
})
expect(res.body.software.name).to.equal('peertube')
@ -118,7 +119,7 @@ describe('Test misc endpoints', function () {
const res = await makeGetRequest({
url: server.url,
path: '/sitemap.xml',
statusCodeExpected: 200
statusCodeExpected: HttpStatusCode.OK_200
})
expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
@ -129,7 +130,7 @@ describe('Test misc endpoints', function () {
const res = await makeGetRequest({
url: server.url,
path: '/sitemap.xml',
statusCodeExpected: 200
statusCodeExpected: HttpStatusCode.OK_200
})
expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
@ -152,7 +153,7 @@ describe('Test misc endpoints', function () {
const res = await makeGetRequest({
url: server.url,
path: '/sitemap.xml?t=1', // avoid using cache
statusCodeExpected: 200
statusCodeExpected: HttpStatusCode.OK_200
})
expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')