diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-06 12:26:58 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-06 12:26:58 +0100 |
commit | 73471b1a52f242e86364ffb077ea6cadb3b07ae2 (patch) | |
tree | 43dbb7748e281f8d80f15326f489cdea10ec857d /server/tests/api/activitypub | |
parent | c22419dd265c0c7185bf4197a1cb286eb3d8ebc0 (diff) | |
parent | f5305c04aae14467d6f957b713c5a902275cbb89 (diff) | |
download | PeerTube-73471b1a52f242e86364ffb077ea6cadb3b07ae2.tar.gz PeerTube-73471b1a52f242e86364ffb077ea6cadb3b07ae2.tar.zst PeerTube-73471b1a52f242e86364ffb077ea6cadb3b07ae2.zip |
Merge branch 'release/v1.2.0'
Diffstat (limited to 'server/tests/api/activitypub')
-rw-r--r-- | server/tests/api/activitypub/client.ts | 6 | ||||
-rw-r--r-- | server/tests/api/activitypub/fetch.ts | 9 | ||||
-rw-r--r-- | server/tests/api/activitypub/helpers.ts | 10 | ||||
-rw-r--r-- | server/tests/api/activitypub/refresher.ts | 19 | ||||
-rw-r--r-- | server/tests/api/activitypub/security.ts | 12 |
5 files changed, 36 insertions, 20 deletions
diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.ts index ea0682634..6d90d8643 100644 --- a/server/tests/api/activitypub/client.ts +++ b/server/tests/api/activitypub/client.ts | |||
@@ -8,10 +8,10 @@ import { | |||
8 | flushTests, | 8 | flushTests, |
9 | killallServers, | 9 | killallServers, |
10 | makeActivityPubGetRequest, | 10 | makeActivityPubGetRequest, |
11 | runServer, | ||
12 | ServerInfo, | 11 | ServerInfo, |
13 | setAccessTokensToServers, uploadVideo | 12 | setAccessTokensToServers, |
14 | } from '../../utils' | 13 | uploadVideo |
14 | } from '../../../../shared/utils' | ||
15 | 15 | ||
16 | const expect = chai.expect | 16 | const expect = chai.expect |
17 | 17 | ||
diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts index a42c606c6..03609c1a9 100644 --- a/server/tests/api/activitypub/fetch.ts +++ b/server/tests/api/activitypub/fetch.ts | |||
@@ -11,12 +11,13 @@ import { | |||
11 | killallServers, | 11 | killallServers, |
12 | ServerInfo, | 12 | ServerInfo, |
13 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
14 | setActorField, | ||
15 | setVideoField, | ||
14 | uploadVideo, | 16 | uploadVideo, |
15 | userLogin | 17 | userLogin, |
16 | } from '../../utils' | 18 | waitJobs |
19 | } from '../../../../shared/utils' | ||
17 | import * as chai from 'chai' | 20 | import * as chai from 'chai' |
18 | import { setActorField, setVideoField } from '../../utils/miscs/sql' | ||
19 | import { waitJobs } from '../../utils/server/jobs' | ||
20 | import { Video } from '../../../../shared/models/videos' | 21 | import { Video } from '../../../../shared/models/videos' |
21 | 22 | ||
22 | const expect = chai.expect | 23 | const expect = chai.expect |
diff --git a/server/tests/api/activitypub/helpers.ts b/server/tests/api/activitypub/helpers.ts index 610846247..ac6e755c3 100644 --- a/server/tests/api/activitypub/helpers.ts +++ b/server/tests/api/activitypub/helpers.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { buildRequestStub } from '../../utils' | 5 | import { buildRequestStub } from '../../../../shared/utils/miscs/stubs' |
6 | import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto' | 6 | import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto' |
7 | import { cloneDeep } from 'lodash' | 7 | import { cloneDeep } from 'lodash' |
8 | import { buildSignedActivity } from '../../../helpers/activitypub' | 8 | import { buildSignedActivity } from '../../../helpers/activitypub' |
@@ -91,7 +91,7 @@ describe('Test activity pub helpers', function () { | |||
91 | req.headers = mastodonObject.headers | 91 | req.headers = mastodonObject.headers |
92 | req.headers.signature = 'Signature ' + req.headers.signature | 92 | req.headers.signature = 'Signature ' + req.headers.signature |
93 | 93 | ||
94 | const parsed = parseHTTPSignature(req, 3600 * 365 * 3) | 94 | const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10) |
95 | const publicKey = require('./json/mastodon/public-key.json').publicKey | 95 | const publicKey = require('./json/mastodon/public-key.json').publicKey |
96 | 96 | ||
97 | const actor = { publicKey } | 97 | const actor = { publicKey } |
@@ -110,7 +110,7 @@ describe('Test activity pub helpers', function () { | |||
110 | req.headers = mastodonObject.headers | 110 | req.headers = mastodonObject.headers |
111 | req.headers.signature = 'Signature ' + req.headers.signature | 111 | req.headers.signature = 'Signature ' + req.headers.signature |
112 | 112 | ||
113 | const parsed = parseHTTPSignature(req, 3600 * 365 * 3) | 113 | const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10) |
114 | const publicKey = require('./json/mastodon/bad-public-key.json').publicKey | 114 | const publicKey = require('./json/mastodon/bad-public-key.json').publicKey |
115 | 115 | ||
116 | const actor = { publicKey } | 116 | const actor = { publicKey } |
@@ -150,7 +150,7 @@ describe('Test activity pub helpers', function () { | |||
150 | 150 | ||
151 | let errored = false | 151 | let errored = false |
152 | try { | 152 | try { |
153 | parseHTTPSignature(req, 3600 * 365 * 3) | 153 | parseHTTPSignature(req, 3600 * 1000 * 365 * 10) |
154 | } catch { | 154 | } catch { |
155 | errored = true | 155 | errored = true |
156 | } | 156 | } |
@@ -168,7 +168,7 @@ describe('Test activity pub helpers', function () { | |||
168 | req.headers = mastodonObject.headers | 168 | req.headers = mastodonObject.headers |
169 | req.headers.signature = 'Signature ' + req.headers.signature | 169 | req.headers.signature = 'Signature ' + req.headers.signature |
170 | 170 | ||
171 | const parsed = parseHTTPSignature(req, 3600 * 365 * 3) | 171 | const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10) |
172 | const publicKey = require('./json/mastodon/public-key.json').publicKey | 172 | const publicKey = require('./json/mastodon/public-key.json').publicKey |
173 | 173 | ||
174 | const actor = { publicKey } | 174 | const actor = { publicKey } |
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts index 67e04f79e..62ad8a0b5 100644 --- a/server/tests/api/activitypub/refresher.ts +++ b/server/tests/api/activitypub/refresher.ts | |||
@@ -1,10 +1,19 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* tslint:disable:no-unused-expression */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { doubleFollow, getVideo, reRunServer } from '../../utils' | 4 | import { |
5 | import { flushAndRunMultipleServers, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo, wait } from '../../utils/index' | 5 | doubleFollow, |
6 | import { waitJobs } from '../../utils/server/jobs' | 6 | flushAndRunMultipleServers, |
7 | import { setVideoField } from '../../utils/miscs/sql' | 7 | getVideo, |
8 | killallServers, | ||
9 | reRunServer, | ||
10 | ServerInfo, | ||
11 | setAccessTokensToServers, | ||
12 | uploadVideo, | ||
13 | wait, | ||
14 | setVideoField, | ||
15 | waitJobs | ||
16 | } from '../../../../shared/utils' | ||
8 | 17 | ||
9 | describe('Test AP refresher', function () { | 18 | describe('Test AP refresher', function () { |
10 | let servers: ServerInfo[] = [] | 19 | let servers: ServerInfo[] = [] |
@@ -13,7 +22,7 @@ describe('Test AP refresher', function () { | |||
13 | let videoUUID3: string | 22 | let videoUUID3: string |
14 | 23 | ||
15 | before(async function () { | 24 | before(async function () { |
16 | this.timeout(30000) | 25 | this.timeout(60000) |
17 | 26 | ||
18 | servers = await flushAndRunMultipleServers(2) | 27 | servers = await flushAndRunMultipleServers(2) |
19 | 28 | ||
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts index 7349749f1..342ae0fa1 100644 --- a/server/tests/api/activitypub/security.ts +++ b/server/tests/api/activitypub/security.ts | |||
@@ -2,13 +2,19 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | 4 | ||
5 | import { flushAndRunMultipleServers, flushTests, killallServers, ServerInfo } from '../../utils' | 5 | import { |
6 | flushAndRunMultipleServers, | ||
7 | flushTests, | ||
8 | killallServers, | ||
9 | makeFollowRequest, | ||
10 | makePOSTAPRequest, | ||
11 | ServerInfo, | ||
12 | setActorField | ||
13 | } from '../../../../shared/utils' | ||
6 | import { HTTP_SIGNATURE } from '../../../initializers' | 14 | import { HTTP_SIGNATURE } from '../../../initializers' |
7 | import { buildDigest, buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils' | 15 | import { buildDigest, buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils' |
8 | import * as chai from 'chai' | 16 | import * as chai from 'chai' |
9 | import { setActorField } from '../../utils/miscs/sql' | ||
10 | import { activityPubContextify, buildSignedActivity } from '../../../helpers/activitypub' | 17 | import { activityPubContextify, buildSignedActivity } from '../../../helpers/activitypub' |
11 | import { makeFollowRequest, makePOSTAPRequest } from '../../utils/requests/activitypub' | ||
12 | 18 | ||
13 | const expect = chai.expect | 19 | const expect = chai.expect |
14 | 20 | ||