diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 10:42:24 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea (patch) | |
tree | baf29753ac5d4598643e3bee719f8df0cc36c59d /server/tests/misc-endpoints.ts | |
parent | 08642a765ea514a00f159db898edf14c376fbe6c (diff) | |
download | PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.gz PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.zst PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.zip |
Refactor requests
Diffstat (limited to 'server/tests/misc-endpoints.ts')
-rw-r--r-- | server/tests/misc-endpoints.ts | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index a4f344fcc..4d9c07f1a 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/models' |
6 | import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' | 6 | import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
7 | import { VideoPrivacy } from '@shared/models' | 7 | import { VideoPrivacy } from '@shared/models' |
8 | 8 | ||
@@ -24,7 +24,7 @@ describe('Test misc endpoints', function () { | |||
24 | const res = await makeGetRequest({ | 24 | const res = await makeGetRequest({ |
25 | url: server.url, | 25 | url: server.url, |
26 | path: '/.well-known/security.txt', | 26 | path: '/.well-known/security.txt', |
27 | statusCodeExpected: HttpStatusCode.OK_200 | 27 | expectedStatus: HttpStatusCode.OK_200 |
28 | }) | 28 | }) |
29 | 29 | ||
30 | expect(res.text).to.contain('security issue') | 30 | expect(res.text).to.contain('security issue') |
@@ -34,7 +34,7 @@ describe('Test misc endpoints', function () { | |||
34 | const res = await makeGetRequest({ | 34 | const res = await makeGetRequest({ |
35 | url: server.url, | 35 | url: server.url, |
36 | path: '/.well-known/nodeinfo', | 36 | path: '/.well-known/nodeinfo', |
37 | statusCodeExpected: HttpStatusCode.OK_200 | 37 | expectedStatus: HttpStatusCode.OK_200 |
38 | }) | 38 | }) |
39 | 39 | ||
40 | expect(res.body.links).to.be.an('array') | 40 | expect(res.body.links).to.be.an('array') |
@@ -46,7 +46,7 @@ describe('Test misc endpoints', function () { | |||
46 | const res = await makeGetRequest({ | 46 | const res = await makeGetRequest({ |
47 | url: server.url, | 47 | url: server.url, |
48 | path: '/.well-known/dnt-policy.txt', | 48 | path: '/.well-known/dnt-policy.txt', |
49 | statusCodeExpected: HttpStatusCode.OK_200 | 49 | expectedStatus: HttpStatusCode.OK_200 |
50 | }) | 50 | }) |
51 | 51 | ||
52 | expect(res.text).to.contain('http://www.w3.org/TR/tracking-dnt') | 52 | expect(res.text).to.contain('http://www.w3.org/TR/tracking-dnt') |
@@ -56,7 +56,7 @@ describe('Test misc endpoints', function () { | |||
56 | const res = await makeGetRequest({ | 56 | const res = await makeGetRequest({ |
57 | url: server.url, | 57 | url: server.url, |
58 | path: '/.well-known/dnt', | 58 | path: '/.well-known/dnt', |
59 | statusCodeExpected: HttpStatusCode.OK_200 | 59 | expectedStatus: HttpStatusCode.OK_200 |
60 | }) | 60 | }) |
61 | 61 | ||
62 | expect(res.body.tracking).to.equal('N') | 62 | expect(res.body.tracking).to.equal('N') |
@@ -66,7 +66,7 @@ describe('Test misc endpoints', function () { | |||
66 | const res = await makeGetRequest({ | 66 | const res = await makeGetRequest({ |
67 | url: server.url, | 67 | url: server.url, |
68 | path: '/.well-known/change-password', | 68 | path: '/.well-known/change-password', |
69 | statusCodeExpected: HttpStatusCode.FOUND_302 | 69 | expectedStatus: HttpStatusCode.FOUND_302 |
70 | }) | 70 | }) |
71 | 71 | ||
72 | expect(res.header.location).to.equal('/my-account/settings') | 72 | expect(res.header.location).to.equal('/my-account/settings') |
@@ -79,7 +79,7 @@ describe('Test misc endpoints', function () { | |||
79 | const res = await makeGetRequest({ | 79 | const res = await makeGetRequest({ |
80 | url: server.url, | 80 | url: server.url, |
81 | path: '/.well-known/webfinger?resource=' + resource, | 81 | path: '/.well-known/webfinger?resource=' + resource, |
82 | statusCodeExpected: HttpStatusCode.OK_200 | 82 | expectedStatus: HttpStatusCode.OK_200 |
83 | }) | 83 | }) |
84 | 84 | ||
85 | const data = res.body | 85 | const data = res.body |
@@ -104,7 +104,7 @@ describe('Test misc endpoints', function () { | |||
104 | const res = await makeGetRequest({ | 104 | const res = await makeGetRequest({ |
105 | url: server.url, | 105 | url: server.url, |
106 | path: '/robots.txt', | 106 | path: '/robots.txt', |
107 | statusCodeExpected: HttpStatusCode.OK_200 | 107 | expectedStatus: HttpStatusCode.OK_200 |
108 | }) | 108 | }) |
109 | 109 | ||
110 | expect(res.text).to.contain('User-agent') | 110 | expect(res.text).to.contain('User-agent') |
@@ -114,7 +114,7 @@ describe('Test misc endpoints', function () { | |||
114 | await makeGetRequest({ | 114 | await makeGetRequest({ |
115 | url: server.url, | 115 | url: server.url, |
116 | path: '/security.txt', | 116 | path: '/security.txt', |
117 | statusCodeExpected: HttpStatusCode.MOVED_PERMANENTLY_301 | 117 | expectedStatus: HttpStatusCode.MOVED_PERMANENTLY_301 |
118 | }) | 118 | }) |
119 | }) | 119 | }) |
120 | 120 | ||
@@ -122,7 +122,7 @@ describe('Test misc endpoints', function () { | |||
122 | const res = await makeGetRequest({ | 122 | const res = await makeGetRequest({ |
123 | url: server.url, | 123 | url: server.url, |
124 | path: '/nodeinfo/2.0.json', | 124 | path: '/nodeinfo/2.0.json', |
125 | statusCodeExpected: HttpStatusCode.OK_200 | 125 | expectedStatus: HttpStatusCode.OK_200 |
126 | }) | 126 | }) |
127 | 127 | ||
128 | expect(res.body.software.name).to.equal('peertube') | 128 | expect(res.body.software.name).to.equal('peertube') |
@@ -137,7 +137,7 @@ describe('Test misc endpoints', function () { | |||
137 | const res = await makeGetRequest({ | 137 | const res = await makeGetRequest({ |
138 | url: server.url, | 138 | url: server.url, |
139 | path: '/sitemap.xml', | 139 | path: '/sitemap.xml', |
140 | statusCodeExpected: HttpStatusCode.OK_200 | 140 | expectedStatus: HttpStatusCode.OK_200 |
141 | }) | 141 | }) |
142 | 142 | ||
143 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') | 143 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') |
@@ -148,7 +148,7 @@ describe('Test misc endpoints', function () { | |||
148 | const res = await makeGetRequest({ | 148 | const res = await makeGetRequest({ |
149 | url: server.url, | 149 | url: server.url, |
150 | path: '/sitemap.xml', | 150 | path: '/sitemap.xml', |
151 | statusCodeExpected: HttpStatusCode.OK_200 | 151 | expectedStatus: HttpStatusCode.OK_200 |
152 | }) | 152 | }) |
153 | 153 | ||
154 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') | 154 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') |
@@ -171,7 +171,7 @@ describe('Test misc endpoints', function () { | |||
171 | const res = await makeGetRequest({ | 171 | const res = await makeGetRequest({ |
172 | url: server.url, | 172 | url: server.url, |
173 | path: '/sitemap.xml?t=1', // avoid using cache | 173 | path: '/sitemap.xml?t=1', // avoid using cache |
174 | statusCodeExpected: HttpStatusCode.OK_200 | 174 | expectedStatus: HttpStatusCode.OK_200 |
175 | }) | 175 | }) |
176 | 176 | ||
177 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') | 177 | expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') |