aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/feeds
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-22 11:15:17 +0200
committerChocobozzz <me@florianbigard.com>2021-07-22 11:48:24 +0200
commit20bafcb61bee2a9a10a500908850c9a7d5e3c8c5 (patch)
tree18d0e8eb693b0fce88b21b282ea6f28836763fe6 /server/tests/feeds
parent13e13377918b65c30b9334920fef4b43e70b964e (diff)
downloadPeerTube-20bafcb61bee2a9a10a500908850c9a7d5e3c8c5.tar.gz
PeerTube-20bafcb61bee2a9a10a500908850c9a7d5e3c8c5.tar.zst
PeerTube-20bafcb61bee2a9a10a500908850c9a7d5e3c8c5.zip
Move apicache in peertube
Allow us to upgrade to node 16
Diffstat (limited to 'server/tests/feeds')
-rw-r--r--server/tests/feeds/feeds.ts40
1 files changed, 37 insertions, 3 deletions
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts
index 5667207c0..55b434846 100644
--- a/server/tests/feeds/feeds.ts
+++ b/server/tests/feeds/feeds.ts
@@ -8,6 +8,7 @@ import {
8 createMultipleServers, 8 createMultipleServers,
9 createSingleServer, 9 createSingleServer,
10 doubleFollow, 10 doubleFollow,
11 makeGetRequest,
11 PeerTubeServer, 12 PeerTubeServer,
12 setAccessTokensToServers, 13 setAccessTokensToServers,
13 waitJobs 14 waitJobs
@@ -52,9 +53,7 @@ describe('Test syndication feeds', () => {
52 } 53 }
53 54
54 { 55 {
55 const attr = { username: 'john', password: 'password' } 56 userAccessToken = await servers[0].users.generateUserAndToken('john')
56 await servers[0].users.create({ username: attr.username, password: attr.password })
57 userAccessToken = await servers[0].login.getAccessToken(attr)
58 57
59 const user = await servers[0].users.getMyInfo({ token: userAccessToken }) 58 const user = await servers[0].users.getMyInfo({ token: userAccessToken })
60 userAccountId = user.account.id 59 userAccountId = user.account.id
@@ -108,6 +107,41 @@ describe('Test syndication feeds', () => {
108 expect(JSON.parse(jsonText)).to.be.jsonSchema({ type: 'object' }) 107 expect(JSON.parse(jsonText)).to.be.jsonSchema({ type: 'object' })
109 } 108 }
110 }) 109 })
110
111 it('Should serve the endpoint with a classic request', async function () {
112 await makeGetRequest({
113 url: servers[0].url,
114 path: '/feeds/videos.xml',
115 accept: 'application/xml',
116 expectedStatus: HttpStatusCode.OK_200
117 })
118 })
119
120 it('Should serve the endpoint as a cached request', async function () {
121 const res = await makeGetRequest({
122 url: servers[0].url,
123 path: '/feeds/videos.xml',
124 accept: 'application/xml',
125 expectedStatus: HttpStatusCode.OK_200
126 })
127
128 expect(res.headers['x-api-cache-cached']).to.equal('true')
129 })
130
131 it('Should not serve the endpoint as a cached request', async function () {
132 const res = await makeGetRequest({
133 url: servers[0].url,
134 path: '/feeds/videos.xml?v=186',
135 accept: 'application/xml',
136 expectedStatus: HttpStatusCode.OK_200
137 })
138
139 expect(res.headers['x-api-cache-cached']).to.not.exist
140 })
141
142 it('Should refuse to serve the endpoint without accept header', async function () {
143 await makeGetRequest({ url: servers[0].url, path: '/feeds/videos.xml', expectedStatus: HttpStatusCode.NOT_ACCEPTABLE_406 })
144 })
111 }) 145 })
112 146
113 describe('Videos feed', function () { 147 describe('Videos feed', function () {