diff options
Diffstat (limited to 'server/tests/api/activitypub/security.ts')
-rw-r--r-- | server/tests/api/activitypub/security.ts | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts index ab0eb256e..c173648b3 100644 --- a/server/tests/api/activitypub/security.ts +++ b/server/tests/api/activitypub/security.ts | |||
@@ -7,10 +7,9 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c | |||
7 | import { | 7 | import { |
8 | buildAbsoluteFixturePath, | 8 | buildAbsoluteFixturePath, |
9 | cleanupTests, | 9 | cleanupTests, |
10 | flushAndRunMultipleServers, | 10 | createMultipleServers, |
11 | killallServers, | 11 | killallServers, |
12 | reRunServer, | 12 | PeerTubeServer, |
13 | ServerInfo, | ||
14 | wait | 13 | wait |
15 | } from '../../../../shared/extra-utils' | 14 | } from '../../../../shared/extra-utils' |
16 | import { makeFollowRequest, makePOSTAPRequest } from '../../../../shared/extra-utils/requests/activitypub' | 15 | import { makeFollowRequest, makePOSTAPRequest } from '../../../../shared/extra-utils/requests/activitypub' |
@@ -20,7 +19,7 @@ import { buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activi | |||
20 | 19 | ||
21 | const expect = chai.expect | 20 | const expect = chai.expect |
22 | 21 | ||
23 | function setKeysOfServer (onServer: ServerInfo, ofServer: ServerInfo, publicKey: string, privateKey: string) { | 22 | function setKeysOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, publicKey: string, privateKey: string) { |
24 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' | 23 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' |
25 | 24 | ||
26 | return Promise.all([ | 25 | return Promise.all([ |
@@ -29,7 +28,7 @@ function setKeysOfServer (onServer: ServerInfo, ofServer: ServerInfo, publicKey: | |||
29 | ]) | 28 | ]) |
30 | } | 29 | } |
31 | 30 | ||
32 | function setUpdatedAtOfServer (onServer: ServerInfo, ofServer: ServerInfo, updatedAt: string) { | 31 | function setUpdatedAtOfServer (onServer: PeerTubeServer, ofServer: PeerTubeServer, updatedAt: string) { |
33 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' | 32 | const url = 'http://localhost:' + ofServer.port + '/accounts/peertube' |
34 | 33 | ||
35 | return Promise.all([ | 34 | return Promise.all([ |
@@ -38,7 +37,7 @@ function setUpdatedAtOfServer (onServer: ServerInfo, ofServer: ServerInfo, updat | |||
38 | ]) | 37 | ]) |
39 | } | 38 | } |
40 | 39 | ||
41 | function getAnnounceWithoutContext (server: ServerInfo) { | 40 | function getAnnounceWithoutContext (server: PeerTubeServer) { |
42 | const json = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json')) | 41 | const json = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json')) |
43 | const result: typeof json = {} | 42 | const result: typeof json = {} |
44 | 43 | ||
@@ -54,7 +53,7 @@ function getAnnounceWithoutContext (server: ServerInfo) { | |||
54 | } | 53 | } |
55 | 54 | ||
56 | describe('Test ActivityPub security', function () { | 55 | describe('Test ActivityPub security', function () { |
57 | let servers: ServerInfo[] | 56 | let servers: PeerTubeServer[] |
58 | let url: string | 57 | let url: string |
59 | 58 | ||
60 | const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/keys.json')) | 59 | const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/keys.json')) |
@@ -72,7 +71,7 @@ describe('Test ActivityPub security', function () { | |||
72 | before(async function () { | 71 | before(async function () { |
73 | this.timeout(60000) | 72 | this.timeout(60000) |
74 | 73 | ||
75 | servers = await flushAndRunMultipleServers(3) | 74 | servers = await createMultipleServers(3) |
76 | 75 | ||
77 | url = servers[0].url + '/inbox' | 76 | url = servers[0].url + '/inbox' |
78 | 77 | ||
@@ -172,7 +171,7 @@ describe('Test ActivityPub security', function () { | |||
172 | 171 | ||
173 | // Invalid peertube actor cache | 172 | // Invalid peertube actor cache |
174 | await killallServers([ servers[1] ]) | 173 | await killallServers([ servers[1] ]) |
175 | await reRunServer(servers[1]) | 174 | await servers[1].run() |
176 | 175 | ||
177 | const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) | 176 | const body = activityPubContextify(getAnnounceWithoutContext(servers[1])) |
178 | const headers = buildGlobalHeaders(body) | 177 | const headers = buildGlobalHeaders(body) |