diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-14 16:52:22 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-15 08:21:12 +0200 |
commit | 3d470a530c4a48b2e4f4a9e7d4f223e14f32cea4 (patch) | |
tree | 7305399caecbf7380319bd08e21c933de88096dc /server/tests/api | |
parent | 79db409a41bd28fd2773626c9a93b5d326a38bc0 (diff) | |
download | PeerTube-3d470a530c4a48b2e4f4a9e7d4f223e14f32cea4.tar.gz PeerTube-3d470a530c4a48b2e4f4a9e7d4f223e14f32cea4.tar.zst PeerTube-3d470a530c4a48b2e4f4a9e7d4f223e14f32cea4.zip |
Faster ci using compiled ts files
Diffstat (limited to 'server/tests/api')
19 files changed, 62 insertions, 527 deletions
diff --git a/server/tests/api/activitypub/helpers.ts b/server/tests/api/activitypub/helpers.ts index 60d95b823..66d7631b7 100644 --- a/server/tests/api/activitypub/helpers.ts +++ b/server/tests/api/activitypub/helpers.ts | |||
@@ -6,13 +6,14 @@ import { buildRequestStub } from '../../../../shared/extra-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' |
9 | import { buildAbsoluteFixturePath } from '@shared/extra-utils' | ||
9 | 10 | ||
10 | describe('Test activity pub helpers', function () { | 11 | describe('Test activity pub helpers', function () { |
11 | describe('When checking the Linked Signature', function () { | 12 | describe('When checking the Linked Signature', function () { |
12 | 13 | ||
13 | it('Should fail with an invalid Mastodon signature', async function () { | 14 | it('Should fail with an invalid Mastodon signature', async function () { |
14 | const body = require('./json/mastodon/create-bad-signature.json') | 15 | const body = require(buildAbsoluteFixturePath('./ap-json/mastodon/create-bad-signature.json')) |
15 | const publicKey = require('./json/mastodon/public-key.json').publicKey | 16 | const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKey |
16 | const fromActor = { publicKey, url: 'http://localhost:9002/accounts/peertube' } | 17 | const fromActor = { publicKey, url: 'http://localhost:9002/accounts/peertube' } |
17 | 18 | ||
18 | const result = await isJsonLDSignatureVerified(fromActor as any, body) | 19 | const result = await isJsonLDSignatureVerified(fromActor as any, body) |
@@ -21,8 +22,8 @@ describe('Test activity pub helpers', function () { | |||
21 | }) | 22 | }) |
22 | 23 | ||
23 | it('Should fail with an invalid public key', async function () { | 24 | it('Should fail with an invalid public key', async function () { |
24 | const body = require('./json/mastodon/create.json') | 25 | const body = require(buildAbsoluteFixturePath('./ap-json/mastodon/create.json')) |
25 | const publicKey = require('./json/mastodon/bad-public-key.json').publicKey | 26 | const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/bad-public-key.json')).publicKey |
26 | const fromActor = { publicKey, url: 'http://localhost:9002/accounts/peertube' } | 27 | const fromActor = { publicKey, url: 'http://localhost:9002/accounts/peertube' } |
27 | 28 | ||
28 | const result = await isJsonLDSignatureVerified(fromActor as any, body) | 29 | const result = await isJsonLDSignatureVerified(fromActor as any, body) |
@@ -31,8 +32,8 @@ describe('Test activity pub helpers', function () { | |||
31 | }) | 32 | }) |
32 | 33 | ||
33 | it('Should succeed with a valid Mastodon signature', async function () { | 34 | it('Should succeed with a valid Mastodon signature', async function () { |
34 | const body = require('./json/mastodon/create.json') | 35 | const body = require(buildAbsoluteFixturePath('./ap-json/mastodon/create.json')) |
35 | const publicKey = require('./json/mastodon/public-key.json').publicKey | 36 | const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKey |
36 | const fromActor = { publicKey, url: 'http://localhost:9002/accounts/peertube' } | 37 | const fromActor = { publicKey, url: 'http://localhost:9002/accounts/peertube' } |
37 | 38 | ||
38 | const result = await isJsonLDSignatureVerified(fromActor as any, body) | 39 | const result = await isJsonLDSignatureVerified(fromActor as any, body) |
@@ -41,8 +42,8 @@ describe('Test activity pub helpers', function () { | |||
41 | }) | 42 | }) |
42 | 43 | ||
43 | it('Should fail with an invalid PeerTube signature', async function () { | 44 | it('Should fail with an invalid PeerTube signature', async function () { |
44 | const keys = require('./json/peertube/invalid-keys.json') | 45 | const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/invalid-keys.json')) |
45 | const body = require('./json/peertube/announce-without-context.json') | 46 | const body = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json')) |
46 | 47 | ||
47 | const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey } | 48 | const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey } |
48 | const signedBody = await buildSignedActivity(actorSignature as any, body) | 49 | const signedBody = await buildSignedActivity(actorSignature as any, body) |
@@ -54,8 +55,8 @@ describe('Test activity pub helpers', function () { | |||
54 | }) | 55 | }) |
55 | 56 | ||
56 | it('Should succeed with a valid PeerTube signature', async function () { | 57 | it('Should succeed with a valid PeerTube signature', async function () { |
57 | const keys = require('./json/peertube/keys.json') | 58 | const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/keys.json')) |
58 | const body = require('./json/peertube/announce-without-context.json') | 59 | const body = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json')) |
59 | 60 | ||
60 | const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey } | 61 | const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey } |
61 | const signedBody = await buildSignedActivity(actorSignature as any, body) | 62 | const signedBody = await buildSignedActivity(actorSignature as any, body) |
@@ -73,12 +74,12 @@ describe('Test activity pub helpers', function () { | |||
73 | req.method = 'POST' | 74 | req.method = 'POST' |
74 | req.url = '/accounts/ronan/inbox' | 75 | req.url = '/accounts/ronan/inbox' |
75 | 76 | ||
76 | const mastodonObject = cloneDeep(require('./json/mastodon/bad-http-signature.json')) | 77 | const mastodonObject = cloneDeep(require(buildAbsoluteFixturePath('./ap-json/mastodon/bad-http-signature.json'))) |
77 | req.body = mastodonObject.body | 78 | req.body = mastodonObject.body |
78 | req.headers = mastodonObject.headers | 79 | req.headers = mastodonObject.headers |
79 | 80 | ||
80 | const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10) | 81 | const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10) |
81 | const publicKey = require('./json/mastodon/public-key.json').publicKey | 82 | const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKey |
82 | 83 | ||
83 | const actor = { publicKey } | 84 | const actor = { publicKey } |
84 | const verified = isHTTPSignatureVerified(parsed, actor as any) | 85 | const verified = isHTTPSignatureVerified(parsed, actor as any) |
@@ -91,12 +92,12 @@ describe('Test activity pub helpers', function () { | |||
91 | req.method = 'POST' | 92 | req.method = 'POST' |
92 | req.url = '/accounts/ronan/inbox' | 93 | req.url = '/accounts/ronan/inbox' |
93 | 94 | ||
94 | const mastodonObject = cloneDeep(require('./json/mastodon/http-signature.json')) | 95 | const mastodonObject = cloneDeep(require(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json'))) |
95 | req.body = mastodonObject.body | 96 | req.body = mastodonObject.body |
96 | req.headers = mastodonObject.headers | 97 | req.headers = mastodonObject.headers |
97 | 98 | ||
98 | const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10) | 99 | const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10) |
99 | const publicKey = require('./json/mastodon/bad-public-key.json').publicKey | 100 | const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/bad-public-key.json')).publicKey |
100 | 101 | ||
101 | const actor = { publicKey } | 102 | const actor = { publicKey } |
102 | const verified = isHTTPSignatureVerified(parsed, actor as any) | 103 | const verified = isHTTPSignatureVerified(parsed, actor as any) |
@@ -109,7 +110,7 @@ describe('Test activity pub helpers', function () { | |||
109 | req.method = 'POST' | 110 | req.method = 'POST' |
110 | req.url = '/accounts/ronan/inbox' | 111 | req.url = '/accounts/ronan/inbox' |
111 | 112 | ||
112 | const mastodonObject = cloneDeep(require('./json/mastodon/http-signature.json')) | 113 | const mastodonObject = cloneDeep(require(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json'))) |
113 | req.body = mastodonObject.body | 114 | req.body = mastodonObject.body |
114 | req.headers = mastodonObject.headers | 115 | req.headers = mastodonObject.headers |
115 | 116 | ||
@@ -128,7 +129,7 @@ describe('Test activity pub helpers', function () { | |||
128 | req.method = 'POST' | 129 | req.method = 'POST' |
129 | req.url = '/accounts/ronan/inbox' | 130 | req.url = '/accounts/ronan/inbox' |
130 | 131 | ||
131 | const mastodonObject = cloneDeep(require('./json/mastodon/http-signature.json')) | 132 | const mastodonObject = cloneDeep(require(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json'))) |
132 | req.body = mastodonObject.body | 133 | req.body = mastodonObject.body |
133 | req.headers = mastodonObject.headers | 134 | req.headers = mastodonObject.headers |
134 | req.headers = 'Signature ' + mastodonObject.headers | 135 | req.headers = 'Signature ' + mastodonObject.headers |
@@ -148,12 +149,12 @@ describe('Test activity pub helpers', function () { | |||
148 | req.method = 'POST' | 149 | req.method = 'POST' |
149 | req.url = '/accounts/ronan/inbox' | 150 | req.url = '/accounts/ronan/inbox' |
150 | 151 | ||
151 | const mastodonObject = cloneDeep(require('./json/mastodon/http-signature.json')) | 152 | const mastodonObject = cloneDeep(require(buildAbsoluteFixturePath('./ap-json/mastodon/http-signature.json'))) |
152 | req.body = mastodonObject.body | 153 | req.body = mastodonObject.body |
153 | req.headers = mastodonObject.headers | 154 | req.headers = mastodonObject.headers |
154 | 155 | ||
155 | const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10) | 156 | const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10) |
156 | const publicKey = require('./json/mastodon/public-key.json').publicKey | 157 | const publicKey = require(buildAbsoluteFixturePath('./ap-json/mastodon/public-key.json')).publicKey |
157 | 158 | ||
158 | const actor = { publicKey } | 159 | const actor = { publicKey } |
159 | const verified = isHTTPSignatureVerified(parsed, actor as any) | 160 | const verified = isHTTPSignatureVerified(parsed, actor as any) |
diff --git a/server/tests/api/activitypub/json/mastodon/bad-body-http-signature.json b/server/tests/api/activitypub/json/mastodon/bad-body-http-signature.json deleted file mode 100644 index 4e7bc3af5..000000000 --- a/server/tests/api/activitypub/json/mastodon/bad-body-http-signature.json +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | { | ||
2 | "headers": { | ||
3 | "user-agent": "http.rb/3.3.0 (Mastodon/2.5.0; +http://localhost:3000/)", | ||
4 | "host": "localhost", | ||
5 | "date": "Mon, 22 Oct 2018 13:34:22 GMT", | ||
6 | "accept-encoding": "gzip", | ||
7 | "digest": "SHA-256=FEr5j2WSSfdEMcG3NTOXuGU0lUchfTJx4+BtUlWOwDk=", | ||
8 | "content-type": "application/activity+json", | ||
9 | "signature": "keyId=\"http://localhost:3000/users/ronan2#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest content-type\",signature=\"oLKbgxdFXdXsHJ3x/UsG9Svu7oa8Dyqiy6Jif4wqNuhAqRVMRaG18f+dd2OcfFX3XRGF8p8flZkU6vvoEQBauTwGRGcgXAJuKC1zYIWGk+PeiW8lNUnE4qGapWcTiFnIo7FKauNdsgqg/tvgs1pQIdHkDDjZMI64twP7sTN/4vG1PCq+kyqi/DM+ORLi/W7vFuLVHt2Iz7ikfw/R3/mMtS4FwLops+tVYBQ2iQ9DVRhTwLKVbeL/LLVB/tdGzNZ4F4nImBAQQ9I7WpPM6J/k+cBmoEbrUKs8ptx9gbX3OSsl5wlvPVMNzU9F9yb2MrB/Y/J4qssKz+LbiaktKGj7OQ==\"", | ||
10 | "content-length": "2815" | ||
11 | }, | ||
12 | "body": { | ||
13 | "@context": [ | ||
14 | "https://www.w3.org/ns/activitystreams", | ||
15 | "https://w3id.org/security/v1", | ||
16 | { | ||
17 | "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", | ||
18 | "sensitive": "as:sensitive", | ||
19 | "movedTo": { | ||
20 | "@id": "as:movedTo", | ||
21 | "@type": "@id" | ||
22 | }, | ||
23 | "Hashtag": "as:Hashtag", | ||
24 | "ostatus": "http://ostatus.org#", | ||
25 | "atomUri": "ostatus:atomUri", | ||
26 | "inReplyToAtomUri": "ostatus:inReplyToAtomUri", | ||
27 | "conversation": "ostatus:conversation", | ||
28 | "toot": "http://joinmastodon.org/ns#", | ||
29 | "Emoji": "toot:Emoji", | ||
30 | "focalPoint": { | ||
31 | "@container": "@list", | ||
32 | "@id": "toot:focalPoint" | ||
33 | }, | ||
34 | "featured": { | ||
35 | "@id": "toot:featured", | ||
36 | "@type": "@id" | ||
37 | }, | ||
38 | "schema": "http://schema.org#", | ||
39 | "PropertyValue": "schema:PropertyValue", | ||
40 | "value": "schema:value" | ||
41 | } | ||
42 | ], | ||
43 | "id": "http://localhost:3000/users/ronan2/statuses/100939547203370948/activity", | ||
44 | "type": "Create", | ||
45 | "actor": "http://localhost:3000/users/ronan2", | ||
46 | "published": "2018-10-22T13:34:18Z", | ||
47 | "to": [ | ||
48 | "https://www.w3.org/ns/activitystreams#Public" | ||
49 | ], | ||
50 | "cc": [ | ||
51 | "http://localhost:3000/users/ronan2/followers", | ||
52 | "http://localhost:9000/accounts/ronan" | ||
53 | ], | ||
54 | "object": { | ||
55 | "id": "http://localhost:3000/users/ronan2/statuses/100939547203370948", | ||
56 | "type": "Note", | ||
57 | "summary": null, | ||
58 | "inReplyTo": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752", | ||
59 | "published": "2018-10-22T13:34:18Z", | ||
60 | "url": "http://localhost:3000/@ronan2/100939547203370948", | ||
61 | "attributedTo": "http://localhost:3000/users/ronan2", | ||
62 | "to": [ | ||
63 | "https://www.w3.org/ns/activitystreams#Public" | ||
64 | ], | ||
65 | "cc": [ | ||
66 | "http://localhost:3000/users/ronan2/followers", | ||
67 | "http://localhost:9000/accounts/ronan" | ||
68 | ], | ||
69 | "sensitive": false, | ||
70 | "atomUri": "http://localhost:3000/users/ronan2/statuses/100939547203370948", | ||
71 | "inReplyToAtomUri": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752", | ||
72 | "conversation": "tag:localhost:3000,2018-10-19:objectId=72:objectType=Conversation", | ||
73 | "content": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>", | ||
74 | "contentMap": { | ||
75 | "en": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>" | ||
76 | }, | ||
77 | "attachment": [], | ||
78 | "tag": [ | ||
79 | { | ||
80 | "type": "Mention", | ||
81 | "href": "http://localhost:9000/accounts/ronan", | ||
82 | "name": "@ronan@localhost:9000" | ||
83 | } | ||
84 | ] | ||
85 | }, | ||
86 | "signature": { | ||
87 | "type": "RsaSignature2017", | ||
88 | "creator": "http://localhost:3000/users/ronan2#main-key", | ||
89 | "created": "2018-10-22T13:34:19Z", | ||
90 | "signatureValue": "x+xL4l8ERziYVhwEafHJyBQOInvNZ0gV4ccYd9AtFYeGJagc8fY6jjjhbDRCD7yMhgTjBX69z20MXnDuwpmM6wej3dt1wLKdIyXVViO84nAlqFz7KmNxtk5lDnAVX/vttscT5YUFvw4dbPT2mQiEd1lKbaLftRiIPEomZpQ37+fUkQdcPrnhruPAISO/Sof1n1LFW4mYIffozteQSZBH6HaCVp+MRMIhdMi5e8w7PD48/cZz8D/EU8Vqi91FM76/3tMqg6nLqQ+8bq74Jvt2kzwZlIufe+I55QMpZOmF6hGIJEt+R0JXdjQbtgcELONmNj2dr8sAlzu7zKlAGuJ24Q==" | ||
91 | } | ||
92 | } | ||
93 | } | ||
diff --git a/server/tests/api/activitypub/json/mastodon/bad-http-signature.json b/server/tests/api/activitypub/json/mastodon/bad-http-signature.json deleted file mode 100644 index 098597db0..000000000 --- a/server/tests/api/activitypub/json/mastodon/bad-http-signature.json +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | { | ||
2 | "headers": { | ||
3 | "user-agent": "http.rb/3.3.0 (Mastodon/2.5.0; +http://localhost:3000/)", | ||
4 | "host": "localhost", | ||
5 | "date": "Mon, 22 Oct 2018 13:34:22 GMT", | ||
6 | "accept-encoding": "gzip", | ||
7 | "digest": "SHA-256=FEr5j2WSSfdEMcG3NTOXuGU0lUchfTJx4+BtUlWOwDk=", | ||
8 | "content-type": "application/activity+json", | ||
9 | "signature": "keyId=\"http://localhost:3000/users/ronan2#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest content-type\",signature=\"oLKbgxdFXdXsHJ3x/UsG9Svu7oa8Dyqiy6Jif4wqNuhAqRVMRaG18f+dd2OcfFX3XRGF8p8flZkU6vvoEQBauTwGRGcgXAJuKC1zYIWGk+PeiW8lNUnE4qGapWcTiFnIo7FKauNdsgqg/tvgs1pQIdHkDDjZMI64twP7sTN/4vG1PCq+kyqi/DM+ORLi/W7vFuLVHt2Iz7ikfw/R3/mMtS4FwLops+tVYBQ2iQ9DVRhTwLKVbeL/LLVB/tdGzNZ4F4nImBAQQ9I7WpPM6J/k+cBmoEbrUKs8ptx9gbX3OSsl4wlvPVMNzU9F9yb2MrB/Y/J4qssKz+LbiaktKGj7OQ==\"", | ||
10 | "content-length": "2815" | ||
11 | }, | ||
12 | "body": { | ||
13 | "@context": [ | ||
14 | "https://www.w3.org/ns/activitystreams", | ||
15 | "https://w3id.org/security/v1", | ||
16 | { | ||
17 | "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", | ||
18 | "sensitive": "as:sensitive", | ||
19 | "movedTo": { | ||
20 | "@id": "as:movedTo", | ||
21 | "@type": "@id" | ||
22 | }, | ||
23 | "Hashtag": "as:Hashtag", | ||
24 | "ostatus": "http://ostatus.org#", | ||
25 | "atomUri": "ostatus:atomUri", | ||
26 | "inReplyToAtomUri": "ostatus:inReplyToAtomUri", | ||
27 | "conversation": "ostatus:conversation", | ||
28 | "toot": "http://joinmastodon.org/ns#", | ||
29 | "Emoji": "toot:Emoji", | ||
30 | "focalPoint": { | ||
31 | "@container": "@list", | ||
32 | "@id": "toot:focalPoint" | ||
33 | }, | ||
34 | "featured": { | ||
35 | "@id": "toot:featured", | ||
36 | "@type": "@id" | ||
37 | }, | ||
38 | "schema": "http://schema.org#", | ||
39 | "PropertyValue": "schema:PropertyValue", | ||
40 | "value": "schema:value" | ||
41 | } | ||
42 | ], | ||
43 | "id": "http://localhost:3000/users/ronan2/statuses/100939547203370948/activity", | ||
44 | "type": "Create", | ||
45 | "actor": "http://localhost:3000/users/ronan2", | ||
46 | "published": "2018-10-22T13:34:18Z", | ||
47 | "to": [ | ||
48 | "https://www.w3.org/ns/activitystreams#Public" | ||
49 | ], | ||
50 | "cc": [ | ||
51 | "http://localhost:3000/users/ronan2/followers", | ||
52 | "http://localhost:9000/accounts/ronan" | ||
53 | ], | ||
54 | "object": { | ||
55 | "id": "http://localhost:3000/users/ronan2/statuses/100939547203370948", | ||
56 | "type": "Note", | ||
57 | "summary": null, | ||
58 | "inReplyTo": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752", | ||
59 | "published": "2018-10-22T13:34:18Z", | ||
60 | "url": "http://localhost:3000/@ronan2/100939547203370948", | ||
61 | "attributedTo": "http://localhost:3000/users/ronan2", | ||
62 | "to": [ | ||
63 | "https://www.w3.org/ns/activitystreams#Public" | ||
64 | ], | ||
65 | "cc": [ | ||
66 | "http://localhost:3000/users/ronan2/followers", | ||
67 | "http://localhost:9000/accounts/ronan" | ||
68 | ], | ||
69 | "sensitive": false, | ||
70 | "atomUri": "http://localhost:3000/users/ronan2/statuses/100939547203370948", | ||
71 | "inReplyToAtomUri": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752", | ||
72 | "conversation": "tag:localhost:3000,2018-10-19:objectId=72:objectType=Conversation", | ||
73 | "content": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>", | ||
74 | "contentMap": { | ||
75 | "en": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>" | ||
76 | }, | ||
77 | "attachment": [], | ||
78 | "tag": [ | ||
79 | { | ||
80 | "type": "Mention", | ||
81 | "href": "http://localhost:9000/accounts/ronan", | ||
82 | "name": "@ronan@localhost:9000" | ||
83 | } | ||
84 | ] | ||
85 | }, | ||
86 | "signature": { | ||
87 | "type": "RsaSignature2017", | ||
88 | "creator": "http://localhost:3000/users/ronan2#main-key", | ||
89 | "created": "2018-10-22T13:34:19Z", | ||
90 | "signatureValue": "x+xL4l8ERziYVhwEafHJyBQOInvNZ0gV4ccYd9AtFYeGJagc8fY6jjjhbDRCD7yMhgTjBX69z20MXnDuwpmM6wej3dt1wLKdIyXVViO84nAlqFz7KmNxtk5lDnAVX/vttscT5YUFvw4dbPT2mQiEd1lKbaLftRiIPEomZpQ37+fUkQdcPrnhruPAISO/Sof1n1LFW4mYIffozteQSZBH6HaCVp+MRMIhdMi5e8w7PD48/cZz8D/EU8Vqi91FM76/3tMqg6nLqQ+8bq74Jvt2kzwZlIufe+I55QMpZOmF6hGIJEt+R0JXdjQbtgcELONmNj2dr8sAlzu7zKlAGuJ24Q==" | ||
91 | } | ||
92 | } | ||
93 | } | ||
diff --git a/server/tests/api/activitypub/json/mastodon/bad-public-key.json b/server/tests/api/activitypub/json/mastodon/bad-public-key.json deleted file mode 100644 index 73d18b3ad..000000000 --- a/server/tests/api/activitypub/json/mastodon/bad-public-key.json +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | { | ||
2 | "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0YyuthHtWWgDe0Fdgdp2\ndC5dTJsRqW6pFw5omIYYYjoES/WRewhVxEA54BhmxD3L1zChfx131N1TS8jVowhW\nm999jpUffKCCvLgYKIXETJDHiDeMONVx8wp7v9fS1HiFXo/E5und39gUMs14CMFZ\n6PE5jRV3r4XIKQJHQl7/X5n5FOb2934K+1TKUeBkbft/AushlKatYQakt3qHxpwx\nFvE+JjGo7QTnzdjaOx/e5QvojdGi2Kx4+jl77j2WVcSo5lOBz04OAVJtChtn82vS\nulPdDh3hZcDn+WK67yAhGP6AnzvOybZZS4zowlKiQ3kqjVVXKdl8gAsL4Y7MZ40R\nJQIDAQAB\n-----END PUBLIC KEY-----\n" | ||
3 | } | ||
diff --git a/server/tests/api/activitypub/json/mastodon/create-bad-signature.json b/server/tests/api/activitypub/json/mastodon/create-bad-signature.json deleted file mode 100644 index 2cd037241..000000000 --- a/server/tests/api/activitypub/json/mastodon/create-bad-signature.json +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | { | ||
2 | "@context": [ | ||
3 | "https://www.w3.org/ns/activitystreams", | ||
4 | "https://w3id.org/security/v1", | ||
5 | { | ||
6 | "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", | ||
7 | "sensitive": "as:sensitive", | ||
8 | "movedTo": { | ||
9 | "@id": "as:movedTo", | ||
10 | "@type": "@id" | ||
11 | }, | ||
12 | "Hashtag": "as:Hashtag", | ||
13 | "ostatus": "http://ostatus.org#", | ||
14 | "atomUri": "ostatus:atomUri", | ||
15 | "inReplyToAtomUri": "ostatus:inReplyToAtomUri", | ||
16 | "conversation": "ostatus:conversation", | ||
17 | "toot": "http://joinmastodon.org/ns#", | ||
18 | "Emoji": "toot:Emoji", | ||
19 | "focalPoint": { | ||
20 | "@container": "@list", | ||
21 | "@id": "toot:focalPoint" | ||
22 | }, | ||
23 | "featured": { | ||
24 | "@id": "toot:featured", | ||
25 | "@type": "@id" | ||
26 | }, | ||
27 | "schema": "http://schema.org#", | ||
28 | "PropertyValue": "schema:PropertyValue", | ||
29 | "value": "schema:value" | ||
30 | } | ||
31 | ], | ||
32 | "id": "http://localhost:3000/users/ronan2/statuses/100939345950887698/activity", | ||
33 | "type": "Create", | ||
34 | "actor": "http://localhost:3000/users/ronan2", | ||
35 | "published": "2018-10-22T12:43:07Z", | ||
36 | "to": [ | ||
37 | "https://www.w3.org/ns/activitystreams#Public" | ||
38 | ], | ||
39 | "cc": [ | ||
40 | "http://localhost:3000/users/ronan2/followers", | ||
41 | "http://localhost:9000/accounts/ronan" | ||
42 | ], | ||
43 | "object": { | ||
44 | "id": "http://localhost:3000/users/ronan2/statuses/100939345950887698", | ||
45 | "type": "Note", | ||
46 | "summary": null, | ||
47 | "inReplyTo": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752", | ||
48 | "published": "2018-10-22T12:43:07Z", | ||
49 | "url": "http://localhost:3000/@ronan2/100939345950887698", | ||
50 | "attributedTo": "http://localhost:3000/users/ronan2", | ||
51 | "to": [ | ||
52 | "https://www.w3.org/ns/activitystreams#Public" | ||
53 | ], | ||
54 | "cc": [ | ||
55 | "http://localhost:3000/users/ronan2/followers", | ||
56 | "http://localhost:9000/accounts/ronan" | ||
57 | ], | ||
58 | "sensitive": false, | ||
59 | "atomUri": "http://localhost:3000/users/ronan2/statuses/100939345950887698", | ||
60 | "inReplyToAtomUri": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752", | ||
61 | "conversation": "tag:localhost:3000,2018-10-19:objectId=72:objectType=Conversation", | ||
62 | "content": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zerg</p>", | ||
63 | "contentMap": { | ||
64 | "en": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zerg</p>" | ||
65 | }, | ||
66 | "attachment": [], | ||
67 | "tag": [ | ||
68 | { | ||
69 | "type": "Mention", | ||
70 | "href": "http://localhost:9000/accounts/ronan", | ||
71 | "name": "@ronan@localhost:9000" | ||
72 | } | ||
73 | ] | ||
74 | }, | ||
75 | "signature": { | ||
76 | "type": "RsaSignature2017", | ||
77 | "creator": "http://localhost:3000/users/ronan2#main-key", | ||
78 | "created": "2018-10-22T12:43:08Z", | ||
79 | "signatureValue": "Vgr8nA0agPr9TcA4BlX+MWhmuE+rBcoIJLpnPbm3E5SnOCXbgjEfEaTLqfuzzkKNsR3PBbkvi3YWK4/DxJ0zmpzSB7yy4NRzluQMVQHqJiFKXAX3Sr3fIrK24xkWW9/F207c1NpFajSGbgnFKBdtFE0e5VqwSrSoOJkZukZW/2ATSnsyzblieuUmvTWpD0PqpUOsynPjw+RqZnqPn0cjw1z2Dm7ZRt3trnyMTXFYZw5U/YuqMY2kpadD6vq780md8kXlJIylxG6ZrlO2jz9fJdnfuVq43d4QFNsBm1K1r2WtNqX+i+wiqh+u3PjF4pzXtl/a3hJOH18IfZnK7I21mQ==" | ||
80 | } | ||
81 | } | ||
diff --git a/server/tests/api/activitypub/json/mastodon/create.json b/server/tests/api/activitypub/json/mastodon/create.json deleted file mode 100644 index 0be271bb8..000000000 --- a/server/tests/api/activitypub/json/mastodon/create.json +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | { | ||
2 | "@context": [ | ||
3 | "https://www.w3.org/ns/activitystreams", | ||
4 | "https://w3id.org/security/v1", | ||
5 | { | ||
6 | "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", | ||
7 | "sensitive": "as:sensitive", | ||
8 | "movedTo": { | ||
9 | "@id": "as:movedTo", | ||
10 | "@type": "@id" | ||
11 | }, | ||
12 | "Hashtag": "as:Hashtag", | ||
13 | "ostatus": "http://ostatus.org#", | ||
14 | "atomUri": "ostatus:atomUri", | ||
15 | "inReplyToAtomUri": "ostatus:inReplyToAtomUri", | ||
16 | "conversation": "ostatus:conversation", | ||
17 | "toot": "http://joinmastodon.org/ns#", | ||
18 | "Emoji": "toot:Emoji", | ||
19 | "focalPoint": { | ||
20 | "@container": "@list", | ||
21 | "@id": "toot:focalPoint" | ||
22 | }, | ||
23 | "featured": { | ||
24 | "@id": "toot:featured", | ||
25 | "@type": "@id" | ||
26 | }, | ||
27 | "schema": "http://schema.org#", | ||
28 | "PropertyValue": "schema:PropertyValue", | ||
29 | "value": "schema:value" | ||
30 | } | ||
31 | ], | ||
32 | "id": "http://localhost:3000/users/ronan2/statuses/100939345950887698/activity", | ||
33 | "type": "Create", | ||
34 | "actor": "http://localhost:3000/users/ronan2", | ||
35 | "published": "2018-10-22T12:43:07Z", | ||
36 | "to": [ | ||
37 | "https://www.w3.org/ns/activitystreams#Public" | ||
38 | ], | ||
39 | "cc": [ | ||
40 | "http://localhost:3000/users/ronan2/followers", | ||
41 | "http://localhost:9000/accounts/ronan" | ||
42 | ], | ||
43 | "object": { | ||
44 | "id": "http://localhost:3000/users/ronan2/statuses/100939345950887698", | ||
45 | "type": "Note", | ||
46 | "summary": null, | ||
47 | "inReplyTo": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752", | ||
48 | "published": "2018-10-22T12:43:07Z", | ||
49 | "url": "http://localhost:3000/@ronan2/100939345950887698", | ||
50 | "attributedTo": "http://localhost:3000/users/ronan2", | ||
51 | "to": [ | ||
52 | "https://www.w3.org/ns/activitystreams#Public" | ||
53 | ], | ||
54 | "cc": [ | ||
55 | "http://localhost:3000/users/ronan2/followers", | ||
56 | "http://localhost:9000/accounts/ronan" | ||
57 | ], | ||
58 | "sensitive": false, | ||
59 | "atomUri": "http://localhost:3000/users/ronan2/statuses/100939345950887698", | ||
60 | "inReplyToAtomUri": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752", | ||
61 | "conversation": "tag:localhost:3000,2018-10-19:objectId=72:objectType=Conversation", | ||
62 | "content": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zerg</p>", | ||
63 | "contentMap": { | ||
64 | "en": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zerg</p>" | ||
65 | }, | ||
66 | "attachment": [], | ||
67 | "tag": [ | ||
68 | { | ||
69 | "type": "Mention", | ||
70 | "href": "http://localhost:9000/accounts/ronan", | ||
71 | "name": "@ronan@localhost:9000" | ||
72 | } | ||
73 | ] | ||
74 | }, | ||
75 | "signature": { | ||
76 | "type": "RsaSignature2017", | ||
77 | "creator": "http://localhost:3000/users/ronan2#main-key", | ||
78 | "created": "2018-10-22T12:43:08Z", | ||
79 | "signatureValue": "VgR8nA0agPr9TcA4BlX+MWhmuE+rBcoIJLpnPbm3E5SnOCXbgjEfEaTLqfuzzkKNsR3PBbkvi3YWK4/DxJ0zmpzSB7yy4NRzluQMVQHqJiFKXAX3Sr3fIrK24xkWW9/F207c1NpFajSGbgnFKBdtFE0e5VqwSrSoOJkZukZW/2ATSnsyzblieuUmvTWpD0PqpUOsynPjw+RqZnqPn0cjw1z2Dm7ZRt3trnyMTXFYZw5U/YuqMY2kpadD6vq780md8kXlJIylxG6ZrlO2jz9fJdnfuVq43d4QFNsBm1K1r2WtNqX+i+wiqh+u3PjF4pzXtl/a3hJOH18IfZnK7I21mQ==" | ||
80 | } | ||
81 | } | ||
diff --git a/server/tests/api/activitypub/json/mastodon/http-signature.json b/server/tests/api/activitypub/json/mastodon/http-signature.json deleted file mode 100644 index 4e7bc3af5..000000000 --- a/server/tests/api/activitypub/json/mastodon/http-signature.json +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | { | ||
2 | "headers": { | ||
3 | "user-agent": "http.rb/3.3.0 (Mastodon/2.5.0; +http://localhost:3000/)", | ||
4 | "host": "localhost", | ||
5 | "date": "Mon, 22 Oct 2018 13:34:22 GMT", | ||
6 | "accept-encoding": "gzip", | ||
7 | "digest": "SHA-256=FEr5j2WSSfdEMcG3NTOXuGU0lUchfTJx4+BtUlWOwDk=", | ||
8 | "content-type": "application/activity+json", | ||
9 | "signature": "keyId=\"http://localhost:3000/users/ronan2#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest content-type\",signature=\"oLKbgxdFXdXsHJ3x/UsG9Svu7oa8Dyqiy6Jif4wqNuhAqRVMRaG18f+dd2OcfFX3XRGF8p8flZkU6vvoEQBauTwGRGcgXAJuKC1zYIWGk+PeiW8lNUnE4qGapWcTiFnIo7FKauNdsgqg/tvgs1pQIdHkDDjZMI64twP7sTN/4vG1PCq+kyqi/DM+ORLi/W7vFuLVHt2Iz7ikfw/R3/mMtS4FwLops+tVYBQ2iQ9DVRhTwLKVbeL/LLVB/tdGzNZ4F4nImBAQQ9I7WpPM6J/k+cBmoEbrUKs8ptx9gbX3OSsl5wlvPVMNzU9F9yb2MrB/Y/J4qssKz+LbiaktKGj7OQ==\"", | ||
10 | "content-length": "2815" | ||
11 | }, | ||
12 | "body": { | ||
13 | "@context": [ | ||
14 | "https://www.w3.org/ns/activitystreams", | ||
15 | "https://w3id.org/security/v1", | ||
16 | { | ||
17 | "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", | ||
18 | "sensitive": "as:sensitive", | ||
19 | "movedTo": { | ||
20 | "@id": "as:movedTo", | ||
21 | "@type": "@id" | ||
22 | }, | ||
23 | "Hashtag": "as:Hashtag", | ||
24 | "ostatus": "http://ostatus.org#", | ||
25 | "atomUri": "ostatus:atomUri", | ||
26 | "inReplyToAtomUri": "ostatus:inReplyToAtomUri", | ||
27 | "conversation": "ostatus:conversation", | ||
28 | "toot": "http://joinmastodon.org/ns#", | ||
29 | "Emoji": "toot:Emoji", | ||
30 | "focalPoint": { | ||
31 | "@container": "@list", | ||
32 | "@id": "toot:focalPoint" | ||
33 | }, | ||
34 | "featured": { | ||
35 | "@id": "toot:featured", | ||
36 | "@type": "@id" | ||
37 | }, | ||
38 | "schema": "http://schema.org#", | ||
39 | "PropertyValue": "schema:PropertyValue", | ||
40 | "value": "schema:value" | ||
41 | } | ||
42 | ], | ||
43 | "id": "http://localhost:3000/users/ronan2/statuses/100939547203370948/activity", | ||
44 | "type": "Create", | ||
45 | "actor": "http://localhost:3000/users/ronan2", | ||
46 | "published": "2018-10-22T13:34:18Z", | ||
47 | "to": [ | ||
48 | "https://www.w3.org/ns/activitystreams#Public" | ||
49 | ], | ||
50 | "cc": [ | ||
51 | "http://localhost:3000/users/ronan2/followers", | ||
52 | "http://localhost:9000/accounts/ronan" | ||
53 | ], | ||
54 | "object": { | ||
55 | "id": "http://localhost:3000/users/ronan2/statuses/100939547203370948", | ||
56 | "type": "Note", | ||
57 | "summary": null, | ||
58 | "inReplyTo": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752", | ||
59 | "published": "2018-10-22T13:34:18Z", | ||
60 | "url": "http://localhost:3000/@ronan2/100939547203370948", | ||
61 | "attributedTo": "http://localhost:3000/users/ronan2", | ||
62 | "to": [ | ||
63 | "https://www.w3.org/ns/activitystreams#Public" | ||
64 | ], | ||
65 | "cc": [ | ||
66 | "http://localhost:3000/users/ronan2/followers", | ||
67 | "http://localhost:9000/accounts/ronan" | ||
68 | ], | ||
69 | "sensitive": false, | ||
70 | "atomUri": "http://localhost:3000/users/ronan2/statuses/100939547203370948", | ||
71 | "inReplyToAtomUri": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752", | ||
72 | "conversation": "tag:localhost:3000,2018-10-19:objectId=72:objectType=Conversation", | ||
73 | "content": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>", | ||
74 | "contentMap": { | ||
75 | "en": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>" | ||
76 | }, | ||
77 | "attachment": [], | ||
78 | "tag": [ | ||
79 | { | ||
80 | "type": "Mention", | ||
81 | "href": "http://localhost:9000/accounts/ronan", | ||
82 | "name": "@ronan@localhost:9000" | ||
83 | } | ||
84 | ] | ||
85 | }, | ||
86 | "signature": { | ||
87 | "type": "RsaSignature2017", | ||
88 | "creator": "http://localhost:3000/users/ronan2#main-key", | ||
89 | "created": "2018-10-22T13:34:19Z", | ||
90 | "signatureValue": "x+xL4l8ERziYVhwEafHJyBQOInvNZ0gV4ccYd9AtFYeGJagc8fY6jjjhbDRCD7yMhgTjBX69z20MXnDuwpmM6wej3dt1wLKdIyXVViO84nAlqFz7KmNxtk5lDnAVX/vttscT5YUFvw4dbPT2mQiEd1lKbaLftRiIPEomZpQ37+fUkQdcPrnhruPAISO/Sof1n1LFW4mYIffozteQSZBH6HaCVp+MRMIhdMi5e8w7PD48/cZz8D/EU8Vqi91FM76/3tMqg6nLqQ+8bq74Jvt2kzwZlIufe+I55QMpZOmF6hGIJEt+R0JXdjQbtgcELONmNj2dr8sAlzu7zKlAGuJ24Q==" | ||
91 | } | ||
92 | } | ||
93 | } | ||
diff --git a/server/tests/api/activitypub/json/mastodon/public-key.json b/server/tests/api/activitypub/json/mastodon/public-key.json deleted file mode 100644 index b7b9b8308..000000000 --- a/server/tests/api/activitypub/json/mastodon/public-key.json +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | { | ||
2 | "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0YyuthHtWWgDe0Fdgdp2\ndC5dTJsRqW6pFw5omIYYYjoES/WRewhVxEA54BhmxD3L1zChfx131N1TS8jVowhW\nm999jpUffKCCvLgYKIXETJDHiDeMONVx8wp7v9fS1HiFXo/E5und39gUMs14CMFZ\n6PE5jRV3r4XIKQJHQl7/X5n5FOb2934K+1TKUeBkbft/AushlKatYQakt3qHxpwx\nFvE+JjGo7QTnzdjaOx/e5QvojdGi2Kx4+jl87j2WVcSo5lOBz04OAVJtChtn82vS\nulPdDh3hZcDn+WK67yAhGP6AnzvOybZZS4zowlKiQ3kqjVVXKdl8gAsL4Y7MZ40R\nJQIDAQAB\n-----END PUBLIC KEY-----\n" | ||
3 | } | ||
diff --git a/server/tests/api/activitypub/json/peertube/announce-without-context.json b/server/tests/api/activitypub/json/peertube/announce-without-context.json deleted file mode 100644 index 5f2af0cde..000000000 --- a/server/tests/api/activitypub/json/peertube/announce-without-context.json +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | { | ||
2 | "type": "Announce", | ||
3 | "id": "http://localhost:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05/announces/1", | ||
4 | "actor": "http://localhost:9002/accounts/peertube", | ||
5 | "object": "http://localhost:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05", | ||
6 | "to": [ | ||
7 | "https://www.w3.org/ns/activitystreams#Public", | ||
8 | "http://localhost:9002/accounts/peertube/followers", | ||
9 | "http://localhost:9002/video-channels/root_channel/followers", | ||
10 | "http://localhost:9002/accounts/root/followers" | ||
11 | ], | ||
12 | "cc": [] | ||
13 | } | ||
diff --git a/server/tests/api/activitypub/json/peertube/invalid-keys.json b/server/tests/api/activitypub/json/peertube/invalid-keys.json deleted file mode 100644 index 0544e96b9..000000000 --- a/server/tests/api/activitypub/json/peertube/invalid-keys.json +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | { | ||
2 | "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqjQGdH6D3naKmSbbr/Df\nEh1H42F3WlHYXuxKLkm5Bemjdde+GwHYdz5m3fcIWw3HTzfA+y9Of8epGdfSrtYO\nwAyc3Zoy7afPNa4bZXqhJ1Im41rMGieiCuUn4uTPPucIjC0gCkVwvuQr3Elbk55s\nIkczDkseJuadTvG+A1e4uNY2lnRmVhf4g5B90u6CLe2KdbPpifRoKlw9zaUBj4/F\npP5S75TS5l1DfJQIq2lp8RwrH6FvGKLnWlbGeNYX96DDvlA5Sxoxz6a+bTV9OopM\n7mS7eP8zF8lKXYUu8cjIscKm+XqGmyRoPyw2Pp53tew29idRUocVQHGBnlNbpKdd\naQIDAQAB\n-----END PUBLIC KEY-----\n", | ||
3 | "privateKey": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAqjQGdH6D3naKmSbbr/DfEh1H42F3WlHYXuxKLkm5Bemjdde+\nGwHYdz5m3fcIWw3HTzfA+y9Of8epGdfSrtYOwAyc3Zoy7afPNa4bZXqhJ1Im41rM\nGieiCuUn4uTPPucIjC0gCkVwvuQr3Elbk55sIkczDkseJuadTvG+A1e4uNY2lnRm\nVhf4g5B90u6CLe2KdbPpifRoKlw9zaUBj4/FpP5S75TS5l1DfJQIq2lp8RwrH6Fv\nGKLnWlbGeNYX96DDvlA5Sxoxz6a+bTV9OopM7mS7eP8zF8lKXYUu8cjIscKm+XqG\nmyRoPyw3Pp53tew29idRUocVQHGBnlNbpKddaQIDAQABAoIBAQCnBZawCtbtH/ay\ng+dhqEW/SOyavbKZ92cU/1tsQPxISRYXNjdf2VfK7HmVqC2S7NqBanz+AVZPHmda\n7OfamkSvQbFN5VvEy8ATNV+9HbG3HG78/MT9hZcGigmyJkcZuy4wILgoXCxfpxlD\netla60PB/4yioiRcmEIWjjOgpByphDJ7RuuuptyEvgjUjpPtvHK47O/loaD2HFJk\nbIYbRirbjUjITRjQxGVIvanqiwPG9pB26YDLxDOoXEumcnzRcEFWNdvoleaLgquS\nn/zVsXWEq4+1i7t44DDstWUt/2Bw5ksIkSdayQ6oy3vzre3YFHwvbVZ7qtQQgpru\nx+NIolZhAoGBAN1RgNj8zy9Py3SJdsoXtnuCItfD7eo7LWXUa06cM/NS695Q+/to\naa5i3cJnRlv+b+b3VvnhkhIBLfFQW+hWwPnnxJEehcm09ddN9zbWrZ4Yv9yYu+8d\nTLGyWL8kPFF1dz+29DcrSv3tXEOwxByX/O4U/X/i3wl2WhkybxVFnCuvAoGBAMTf\n91BgLzvcYKOxH+vRPOJY7g2HKGFe35R91M4E+9Eq1rq4LUQHBb3fhRh4+scNu0yb\nNfN1Zdx2nbgCXdTKomF1Ahxp58/A2iU65vVzL6hYfWXEGSmoBqsGCIpIxQ9jgB9k\nCl7t/Ban8Z/ORHTjI9fpHlSZyCWJ3ajepiM2a1ZnAoGAPpDO6wi1DXvyWVSPF1yS\nwuGsNfD2rjPihpoBZ+yypwP3GBcu1QjUb28Vn+KQOmt4eQPNO8DwCVT6BvEfulPk\nJAHISPom+jnFEgPBcmhIFpyKiLNI1bUjvExd2FNHFgQuHP38ligQAC782Un8dtTk\ntO2MKH4bbVJe8CaYzpuqJZMCgYABZyMpBHZxs8FQiUuT75rCdiXEHOlxwC5RrY/d\no/VzaR28mOFhsbcdwkD9iqcm0fc6tYRt5rFCH+pBzGqEwKjljuLj9vE67sHfMAtD\nRn3Zcj/6gKo5PMRHZbSb36bf1DKuhpT4VjPMqYe0PtEIEDJKMJQRwELH2bKlqGiA\nqbucEwKBgQCkS85JnpHEV/tSylsEEn2W3CQCx58zl7iZNV7h/tWMR4AyrcI0HqP6\nllJ7V/Cfw66MgelPnosKgagwLVI6gsqDtjnzYo3XuMRVlYIySJ/jV3eiUNkV2Ky2\nfp/gA9sVgp38QSr+xB9E0LNStcbqDzoCCcDRws/SK7PbkQH9KV47tQ==\n-----END RSA PRIVATE KEY-----" | ||
4 | } | ||
5 | |||
6 | |||
diff --git a/server/tests/api/activitypub/json/peertube/keys.json b/server/tests/api/activitypub/json/peertube/keys.json deleted file mode 100644 index 1a7700865..000000000 --- a/server/tests/api/activitypub/json/peertube/keys.json +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | { | ||
2 | "publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqjQGdH6D3naKmSbbr/Df\nEh1H42F3WlHYXuxKLkm5Bemjdde+GwHYdz5m3fcIWw3HTzfA+y9Of8epGdfSrtYO\nwAyc3Zoy7afPNa4bZXqhJ1Im41rMGieiCuUn4uTPPucIjC0gCkVwvuQr3Elbk55s\nIkczDkseJuadTvG+A1e4uNY2lnRmVhf4g5B90u6CLe2KdbPpifRoKlw9zaUBj4/F\npP5S75TS5l1DfJQIq2lp8RwrH6FvGKLnWlbGeNYX96DDvlA5Sxoxz6a+bTV9OopM\n7mS7eP8zF8lKXYUu8cjIscKm+XqGmyRoPyw3Pp53tew29idRUocVQHGBnlNbpKdd\naQIDAQAB\n-----END PUBLIC KEY-----\n", | ||
3 | "privateKey": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAqjQGdH6D3naKmSbbr/DfEh1H42F3WlHYXuxKLkm5Bemjdde+\nGwHYdz5m3fcIWw3HTzfA+y9Of8epGdfSrtYOwAyc3Zoy7afPNa4bZXqhJ1Im41rM\nGieiCuUn4uTPPucIjC0gCkVwvuQr3Elbk55sIkczDkseJuadTvG+A1e4uNY2lnRm\nVhf4g5B90u6CLe2KdbPpifRoKlw9zaUBj4/FpP5S75TS5l1DfJQIq2lp8RwrH6Fv\nGKLnWlbGeNYX96DDvlA5Sxoxz6a+bTV9OopM7mS7eP8zF8lKXYUu8cjIscKm+XqG\nmyRoPyw3Pp53tew29idRUocVQHGBnlNbpKddaQIDAQABAoIBAQCnBZawCtbtH/ay\ng+dhqEW/SOyavbKZ92cU/1tsQPxISRYXNjdf2VfK7HmVqC2S7NqBanz+AVZPHmda\n7OfamkSvQbFN5VvEy8ATNV+9HbG3HG78/MT9hZcGigmyJkcZuy4wILgoXCxfpxlD\netla60PB/4yioiRcmEIWjjOgpByphDJ7RuuuptyEvgjUjpPtvHK47O/loaD2HFJk\nbIYbRirbjUjITRjQxGVIvanqiwPG9pB26YDLxDOoXEumcnzRcEFWNdvoleaLgquS\nn/zVsXWEq4+1i7t44DDstWUt/2Bw5ksIkSdayQ6oy3vzre3YFHwvbVZ7qtQQgpru\nx+NIolZhAoGBAN1RgNj8zy9Py3SJdsoXtnuCItfD7eo7LWXUa06cM/NS695Q+/to\naa5i3cJnRlv+b+b3VvnhkhIBLfFQW+hWwPnnxJEehcm09ddN9zbWrZ4Yv9yYu+8d\nTLGyWL8kPFF1dz+29DcrSv3tXEOwxByX/O4U/X/i3wl2WhkybxVFnCuvAoGBAMTf\n91BgLzvcYKOxH+vRPOJY7g2HKGFe35R91M4E+9Eq1rq4LUQHBb3fhRh4+scNu0yb\nNfN1Zdx2nbgCXdTKomF1Ahxp58/A2iU65vVzL6hYfWXEGSmoBqsGCIpIxQ9jgB9k\nCl7t/Ban8Z/ORHTjI9fpHlSZyCWJ3ajepiM2a1ZnAoGAPpDO6wi1DXvyWVSPF1yS\nwuGsNfD2rjPihpoBZ+yypwP3GBcu1QjUb28Vn+KQOmt4eQPNO8DwCVT6BvEfulPk\nJAHISPom+jnFEgPBcmhIFpyKiLNI1bUjvExd2FNHFgQuHP38ligQAC782Un8dtTk\ntO2MKH4bbVJe8CaYzpuqJZMCgYABZyMpBHZxs8FQiUuT75rCdiXEHOlxwC5RrY/d\no/VzaR28mOFhsbcdwkD9iqcm0fc6tYRt5rFCH+pBzGqEwKjljuLj9vE67sHfMAtD\nRn3Zcj/6gKo5PMRHZbSb36bf1DKuhpT4VjPMqYe0PtEIEDJKMJQRwELH2bKlqGiA\nqbucEwKBgQCkS85JnpHEV/tSylsEEn2W3CQCx58zl7iZNV7h/tWMR4AyrcI0HqP6\nllJ7V/Cfw66MgelPnosKgagwLVI6gsqDtjnzYo3XuMRVlYIySJ/jV3eiUNkV2Ky2\nfp/gA9sVgp38QSr+xB9E0LNStcbqDzoCCcDRws/SK7PbkQH9KV47tQ==\n-----END RSA PRIVATE KEY-----" | ||
4 | } | ||
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts index 364b53e0f..61db272f6 100644 --- a/server/tests/api/activitypub/security.ts +++ b/server/tests/api/activitypub/security.ts | |||
@@ -5,6 +5,7 @@ import * as chai from 'chai' | |||
5 | import { buildDigest } from '@server/helpers/peertube-crypto' | 5 | import { buildDigest } from '@server/helpers/peertube-crypto' |
6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
7 | import { | 7 | import { |
8 | buildAbsoluteFixturePath, | ||
8 | cleanupTests, | 9 | cleanupTests, |
9 | closeAllSequelize, | 10 | closeAllSequelize, |
10 | flushAndRunMultipleServers, | 11 | flushAndRunMultipleServers, |
@@ -40,7 +41,7 @@ function setUpdatedAtOfServer (onServer: ServerInfo, ofServer: ServerInfo, updat | |||
40 | } | 41 | } |
41 | 42 | ||
42 | function getAnnounceWithoutContext (server: ServerInfo) { | 43 | function getAnnounceWithoutContext (server: ServerInfo) { |
43 | const json = require('./json/peertube/announce-without-context.json') | 44 | const json = require(buildAbsoluteFixturePath('./ap-json/peertube/announce-without-context.json')) |
44 | const result: typeof json = {} | 45 | const result: typeof json = {} |
45 | 46 | ||
46 | for (const key of Object.keys(json)) { | 47 | for (const key of Object.keys(json)) { |
@@ -58,8 +59,8 @@ describe('Test ActivityPub security', function () { | |||
58 | let servers: ServerInfo[] | 59 | let servers: ServerInfo[] |
59 | let url: string | 60 | let url: string |
60 | 61 | ||
61 | const keys = require('./json/peertube/keys.json') | 62 | const keys = require(buildAbsoluteFixturePath('./ap-json/peertube/keys.json')) |
62 | const invalidKeys = require('./json/peertube/invalid-keys.json') | 63 | const invalidKeys = require(buildAbsoluteFixturePath('./ap-json/peertube/invalid-keys.json')) |
63 | const baseHttpSignature = () => ({ | 64 | const baseHttpSignature = () => ({ |
64 | algorithm: HTTP_SIGNATURE.ALGORITHM, | 65 | algorithm: HTTP_SIGNATURE.ALGORITHM, |
65 | authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME, | 66 | authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME, |
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts index c171b1f81..32233c9da 100644 --- a/server/tests/api/check-params/live.ts +++ b/server/tests/api/check-params/live.ts | |||
@@ -2,9 +2,10 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { join } from 'path' | ||
6 | import { LiveVideo, VideoPrivacy } from '@shared/models' | 5 | import { LiveVideo, VideoPrivacy } from '@shared/models' |
6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
7 | import { | 7 | import { |
8 | buildAbsoluteFixturePath, | ||
8 | cleanupTests, | 9 | cleanupTests, |
9 | createUser, | 10 | createUser, |
10 | flushAndRunServer, | 11 | flushAndRunServer, |
@@ -24,7 +25,6 @@ import { | |||
24 | userLogin, | 25 | userLogin, |
25 | waitUntilLivePublished | 26 | waitUntilLivePublished |
26 | } from '../../../../shared/extra-utils' | 27 | } from '../../../../shared/extra-utils' |
27 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
28 | 28 | ||
29 | describe('Test video lives API validator', function () { | 29 | describe('Test video lives API validator', function () { |
30 | const path = '/api/v1/videos/live' | 30 | const path = '/api/v1/videos/live' |
@@ -180,7 +180,7 @@ describe('Test video lives API validator', function () { | |||
180 | it('Should fail with an incorrect thumbnail file', async function () { | 180 | it('Should fail with an incorrect thumbnail file', async function () { |
181 | const fields = baseCorrectParams | 181 | const fields = baseCorrectParams |
182 | const attaches = { | 182 | const attaches = { |
183 | thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') | 183 | thumbnailfile: buildAbsoluteFixturePath('video_short.mp4') |
184 | } | 184 | } |
185 | 185 | ||
186 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) | 186 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) |
@@ -189,7 +189,7 @@ describe('Test video lives API validator', function () { | |||
189 | it('Should fail with a big thumbnail file', async function () { | 189 | it('Should fail with a big thumbnail file', async function () { |
190 | const fields = baseCorrectParams | 190 | const fields = baseCorrectParams |
191 | const attaches = { | 191 | const attaches = { |
192 | thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png') | 192 | thumbnailfile: buildAbsoluteFixturePath('preview-big.png') |
193 | } | 193 | } |
194 | 194 | ||
195 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) | 195 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) |
@@ -198,7 +198,7 @@ describe('Test video lives API validator', function () { | |||
198 | it('Should fail with an incorrect preview file', async function () { | 198 | it('Should fail with an incorrect preview file', async function () { |
199 | const fields = baseCorrectParams | 199 | const fields = baseCorrectParams |
200 | const attaches = { | 200 | const attaches = { |
201 | previewfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') | 201 | previewfile: buildAbsoluteFixturePath('video_short.mp4') |
202 | } | 202 | } |
203 | 203 | ||
204 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) | 204 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) |
@@ -207,7 +207,7 @@ describe('Test video lives API validator', function () { | |||
207 | it('Should fail with a big preview file', async function () { | 207 | it('Should fail with a big preview file', async function () { |
208 | const fields = baseCorrectParams | 208 | const fields = baseCorrectParams |
209 | const attaches = { | 209 | const attaches = { |
210 | previewfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png') | 210 | previewfile: buildAbsoluteFixturePath('preview-big.png') |
211 | } | 211 | } |
212 | 212 | ||
213 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) | 213 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) |
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index dcff0d52b..36482ee17 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts | |||
@@ -2,12 +2,12 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { join } from 'path' | ||
6 | import { User, UserRole } from '../../../../shared' | 5 | import { User, UserRole } from '../../../../shared' |
7 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
8 | import { | 7 | import { |
9 | addVideoChannel, | 8 | addVideoChannel, |
10 | blockUser, | 9 | blockUser, |
10 | buildAbsoluteFixturePath, | ||
11 | cleanupTests, | 11 | cleanupTests, |
12 | createUser, | 12 | createUser, |
13 | deleteMe, | 13 | deleteMe, |
@@ -600,7 +600,7 @@ describe('Test users API validators', function () { | |||
600 | it('Should fail without an incorrect input file', async function () { | 600 | it('Should fail without an incorrect input file', async function () { |
601 | const fields = {} | 601 | const fields = {} |
602 | const attaches = { | 602 | const attaches = { |
603 | avatarfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') | 603 | avatarfile: buildAbsoluteFixturePath('video_short.mp4') |
604 | } | 604 | } |
605 | await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) | 605 | await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) |
606 | }) | 606 | }) |
@@ -608,7 +608,7 @@ describe('Test users API validators', function () { | |||
608 | it('Should fail with a big file', async function () { | 608 | it('Should fail with a big file', async function () { |
609 | const fields = {} | 609 | const fields = {} |
610 | const attaches = { | 610 | const attaches = { |
611 | avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') | 611 | avatarfile: buildAbsoluteFixturePath('avatar-big.png') |
612 | } | 612 | } |
613 | await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) | 613 | await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) |
614 | }) | 614 | }) |
@@ -616,7 +616,7 @@ describe('Test users API validators', function () { | |||
616 | it('Should fail with an unauthenticated user', async function () { | 616 | it('Should fail with an unauthenticated user', async function () { |
617 | const fields = {} | 617 | const fields = {} |
618 | const attaches = { | 618 | const attaches = { |
619 | avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') | 619 | avatarfile: buildAbsoluteFixturePath('avatar.png') |
620 | } | 620 | } |
621 | await makeUploadRequest({ | 621 | await makeUploadRequest({ |
622 | url: server.url, | 622 | url: server.url, |
@@ -630,7 +630,7 @@ describe('Test users API validators', function () { | |||
630 | it('Should succeed with the correct params', async function () { | 630 | it('Should succeed with the correct params', async function () { |
631 | const fields = {} | 631 | const fields = {} |
632 | const attaches = { | 632 | const attaches = { |
633 | avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') | 633 | avatarfile: buildAbsoluteFixturePath('avatar.png') |
634 | } | 634 | } |
635 | await makeUploadRequest({ | 635 | await makeUploadRequest({ |
636 | url: server.url, | 636 | url: server.url, |
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts index 2f049c03d..1ce2202d2 100644 --- a/server/tests/api/check-params/video-captions.ts +++ b/server/tests/api/check-params/video-captions.ts | |||
@@ -1,7 +1,10 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | |||
5 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
4 | import { | 6 | import { |
7 | buildAbsoluteFixturePath, | ||
5 | cleanupTests, | 8 | cleanupTests, |
6 | createUser, | 9 | createUser, |
7 | flushAndRunServer, | 10 | flushAndRunServer, |
@@ -13,9 +16,7 @@ import { | |||
13 | uploadVideo, | 16 | uploadVideo, |
14 | userLogin | 17 | userLogin |
15 | } from '../../../../shared/extra-utils' | 18 | } from '../../../../shared/extra-utils' |
16 | import { join } from 'path' | ||
17 | import { createVideoCaption } from '../../../../shared/extra-utils/videos/video-captions' | 19 | import { createVideoCaption } from '../../../../shared/extra-utils/videos/video-captions' |
18 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
19 | 20 | ||
20 | describe('Test video captions API validator', function () { | 21 | describe('Test video captions API validator', function () { |
21 | const path = '/api/v1/videos/' | 22 | const path = '/api/v1/videos/' |
@@ -51,7 +52,7 @@ describe('Test video captions API validator', function () { | |||
51 | describe('When adding video caption', function () { | 52 | describe('When adding video caption', function () { |
52 | const fields = { } | 53 | const fields = { } |
53 | const attaches = { | 54 | const attaches = { |
54 | captionfile: join(__dirname, '..', '..', 'fixtures', 'subtitle-good1.vtt') | 55 | captionfile: buildAbsoluteFixturePath('subtitle-good1.vtt') |
55 | } | 56 | } |
56 | 57 | ||
57 | it('Should fail without a valid uuid', async function () { | 58 | it('Should fail without a valid uuid', async function () { |
@@ -129,7 +130,7 @@ describe('Test video captions API validator', function () { | |||
129 | // We accept any file now | 130 | // We accept any file now |
130 | // it('Should fail with an invalid captionfile extension', async function () { | 131 | // it('Should fail with an invalid captionfile extension', async function () { |
131 | // const attaches = { | 132 | // const attaches = { |
132 | // 'captionfile': join(__dirname, '..', '..', 'fixtures', 'subtitle-bad.txt') | 133 | // 'captionfile': buildAbsoluteFixturePath('subtitle-bad.txt') |
133 | // } | 134 | // } |
134 | // | 135 | // |
135 | // const captionPath = path + videoUUID + '/captions/fr' | 136 | // const captionPath = path + videoUUID + '/captions/fr' |
@@ -171,7 +172,7 @@ describe('Test video captions API validator', function () { | |||
171 | // We don't check the file validity yet | 172 | // We don't check the file validity yet |
172 | // it('Should fail with an invalid captionfile srt', async function () { | 173 | // it('Should fail with an invalid captionfile srt', async function () { |
173 | // const attaches = { | 174 | // const attaches = { |
174 | // 'captionfile': join(__dirname, '..', '..', 'fixtures', 'subtitle-bad.srt') | 175 | // 'captionfile': buildAbsoluteFixturePath('subtitle-bad.srt') |
175 | // } | 176 | // } |
176 | // | 177 | // |
177 | // const captionPath = path + videoUUID + '/captions/fr' | 178 | // const captionPath = path + videoUUID + '/captions/fr' |
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts index bc2e6192e..5c02afd31 100644 --- a/server/tests/api/check-params/video-channels.ts +++ b/server/tests/api/check-params/video-channels.ts | |||
@@ -1,9 +1,11 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | ||
3 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
4 | import { omit } from 'lodash' | 5 | import { omit } from 'lodash' |
5 | import 'mocha' | 6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
6 | import { | 7 | import { |
8 | buildAbsoluteFixturePath, | ||
7 | cleanupTests, | 9 | cleanupTests, |
8 | createUser, | 10 | createUser, |
9 | deleteVideoChannel, | 11 | deleteVideoChannel, |
@@ -23,9 +25,7 @@ import { | |||
23 | checkBadSortPagination, | 25 | checkBadSortPagination, |
24 | checkBadStartPagination | 26 | checkBadStartPagination |
25 | } from '../../../../shared/extra-utils/requests/check-api-params' | 27 | } from '../../../../shared/extra-utils/requests/check-api-params' |
26 | import { join } from 'path' | ||
27 | import { VideoChannelUpdate } from '../../../../shared/models/videos' | 28 | import { VideoChannelUpdate } from '../../../../shared/models/videos' |
28 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
29 | 29 | ||
30 | const expect = chai.expect | 30 | const expect = chai.expect |
31 | 31 | ||
@@ -246,7 +246,7 @@ describe('Test video channels API validator', function () { | |||
246 | for (const type of types) { | 246 | for (const type of types) { |
247 | const fields = {} | 247 | const fields = {} |
248 | const attaches = { | 248 | const attaches = { |
249 | [type + 'file']: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') | 249 | [type + 'file']: buildAbsoluteFixturePath('video_short.mp4') |
250 | } | 250 | } |
251 | 251 | ||
252 | await makeUploadRequest({ url: server.url, path: `${path}/${type}/pick`, token: server.accessToken, fields, attaches }) | 252 | await makeUploadRequest({ url: server.url, path: `${path}/${type}/pick`, token: server.accessToken, fields, attaches }) |
@@ -257,7 +257,7 @@ describe('Test video channels API validator', function () { | |||
257 | for (const type of types) { | 257 | for (const type of types) { |
258 | const fields = {} | 258 | const fields = {} |
259 | const attaches = { | 259 | const attaches = { |
260 | [type + 'file']: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') | 260 | [type + 'file']: buildAbsoluteFixturePath('avatar-big.png') |
261 | } | 261 | } |
262 | await makeUploadRequest({ url: server.url, path: `${path}/${type}/pick`, token: server.accessToken, fields, attaches }) | 262 | await makeUploadRequest({ url: server.url, path: `${path}/${type}/pick`, token: server.accessToken, fields, attaches }) |
263 | } | 263 | } |
@@ -267,7 +267,7 @@ describe('Test video channels API validator', function () { | |||
267 | for (const type of types) { | 267 | for (const type of types) { |
268 | const fields = {} | 268 | const fields = {} |
269 | const attaches = { | 269 | const attaches = { |
270 | [type + 'file']: join(__dirname, '..', '..', 'fixtures', 'avatar.png') | 270 | [type + 'file']: buildAbsoluteFixturePath('avatar.png') |
271 | } | 271 | } |
272 | await makeUploadRequest({ | 272 | await makeUploadRequest({ |
273 | url: server.url, | 273 | url: server.url, |
@@ -283,7 +283,7 @@ describe('Test video channels API validator', function () { | |||
283 | for (const type of types) { | 283 | for (const type of types) { |
284 | const fields = {} | 284 | const fields = {} |
285 | const attaches = { | 285 | const attaches = { |
286 | [type + 'file']: join(__dirname, '..', '..', 'fixtures', 'avatar.png') | 286 | [type + 'file']: buildAbsoluteFixturePath('avatar.png') |
287 | } | 287 | } |
288 | await makeUploadRequest({ | 288 | await makeUploadRequest({ |
289 | url: server.url, | 289 | url: server.url, |
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index 6de6b40c8..a27b624d0 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts | |||
@@ -2,8 +2,9 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { join } from 'path' | 5 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
6 | import { | 6 | import { |
7 | buildAbsoluteFixturePath, | ||
7 | cleanupTests, | 8 | cleanupTests, |
8 | createUser, | 9 | createUser, |
9 | flushAndRunServer, | 10 | flushAndRunServer, |
@@ -22,9 +23,8 @@ import { | |||
22 | checkBadSortPagination, | 23 | checkBadSortPagination, |
23 | checkBadStartPagination | 24 | checkBadStartPagination |
24 | } from '../../../../shared/extra-utils/requests/check-api-params' | 25 | } from '../../../../shared/extra-utils/requests/check-api-params' |
25 | import { getMagnetURI, getGoodVideoUrl } from '../../../../shared/extra-utils/videos/video-imports' | 26 | import { getGoodVideoUrl, getMagnetURI } from '../../../../shared/extra-utils/videos/video-imports' |
26 | import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' | 27 | import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' |
27 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
28 | 28 | ||
29 | describe('Test video imports API validator', function () { | 29 | describe('Test video imports API validator', function () { |
30 | const path = '/api/v1/videos/imports' | 30 | const path = '/api/v1/videos/imports' |
@@ -201,7 +201,7 @@ describe('Test video imports API validator', function () { | |||
201 | it('Should fail with an incorrect thumbnail file', async function () { | 201 | it('Should fail with an incorrect thumbnail file', async function () { |
202 | const fields = baseCorrectParams | 202 | const fields = baseCorrectParams |
203 | const attaches = { | 203 | const attaches = { |
204 | thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') | 204 | thumbnailfile: buildAbsoluteFixturePath('video_short.mp4') |
205 | } | 205 | } |
206 | 206 | ||
207 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) | 207 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) |
@@ -210,7 +210,7 @@ describe('Test video imports API validator', function () { | |||
210 | it('Should fail with a big thumbnail file', async function () { | 210 | it('Should fail with a big thumbnail file', async function () { |
211 | const fields = baseCorrectParams | 211 | const fields = baseCorrectParams |
212 | const attaches = { | 212 | const attaches = { |
213 | thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png') | 213 | thumbnailfile: buildAbsoluteFixturePath('preview-big.png') |
214 | } | 214 | } |
215 | 215 | ||
216 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) | 216 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) |
@@ -219,7 +219,7 @@ describe('Test video imports API validator', function () { | |||
219 | it('Should fail with an incorrect preview file', async function () { | 219 | it('Should fail with an incorrect preview file', async function () { |
220 | const fields = baseCorrectParams | 220 | const fields = baseCorrectParams |
221 | const attaches = { | 221 | const attaches = { |
222 | previewfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') | 222 | previewfile: buildAbsoluteFixturePath('video_short.mp4') |
223 | } | 223 | } |
224 | 224 | ||
225 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) | 225 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) |
@@ -228,7 +228,7 @@ describe('Test video imports API validator', function () { | |||
228 | it('Should fail with a big preview file', async function () { | 228 | it('Should fail with a big preview file', async function () { |
229 | const fields = baseCorrectParams | 229 | const fields = baseCorrectParams |
230 | const attaches = { | 230 | const attaches = { |
231 | previewfile: join(__dirname, '..', '..', 'fixtures', 'preview-big.png') | 231 | previewfile: buildAbsoluteFixturePath('preview-big.png') |
232 | } | 232 | } |
233 | 233 | ||
234 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) | 234 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) |
@@ -237,7 +237,7 @@ describe('Test video imports API validator', function () { | |||
237 | it('Should fail with an invalid torrent file', async function () { | 237 | it('Should fail with an invalid torrent file', async function () { |
238 | const fields = omit(baseCorrectParams, 'targetUrl') | 238 | const fields = omit(baseCorrectParams, 'targetUrl') |
239 | const attaches = { | 239 | const attaches = { |
240 | torrentfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') | 240 | torrentfile: buildAbsoluteFixturePath('avatar-big.png') |
241 | } | 241 | } |
242 | 242 | ||
243 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) | 243 | await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) |
@@ -312,7 +312,7 @@ describe('Test video imports API validator', function () { | |||
312 | 312 | ||
313 | fields = omit(fields, 'magnetUri') | 313 | fields = omit(fields, 'magnetUri') |
314 | const attaches = { | 314 | const attaches = { |
315 | torrentfile: join(__dirname, '..', '..', 'fixtures', 'video-720p.torrent') | 315 | torrentfile: buildAbsoluteFixturePath('video-720p.torrent') |
316 | } | 316 | } |
317 | 317 | ||
318 | await makeUploadRequest({ | 318 | await makeUploadRequest({ |
diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts index 9b4af1915..8851ad55e 100644 --- a/server/tests/api/server/contact-form.ts +++ b/server/tests/api/server/contact-form.ts | |||
@@ -54,6 +54,10 @@ describe('Test contact form', function () { | |||
54 | }) | 54 | }) |
55 | 55 | ||
56 | it('Should not be able to send another contact form because of the anti spam checker', async function () { | 56 | it('Should not be able to send another contact form because of the anti spam checker', async function () { |
57 | this.timeout(10000) | ||
58 | |||
59 | await wait(1000) | ||
60 | |||
57 | await sendContactForm({ | 61 | await sendContactForm({ |
58 | url: server.url, | 62 | url: server.url, |
59 | fromEmail: 'toto@example.com', | 63 | fromEmail: 'toto@example.com', |
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index e80d69cf3..a8c8a889b 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -2,11 +2,11 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { join } from 'path' | ||
6 | import * as request from 'supertest' | 5 | import * as request from 'supertest' |
7 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
8 | import { | 7 | import { |
9 | addVideoChannel, | 8 | addVideoChannel, |
9 | buildAbsoluteFixturePath, | ||
10 | checkTmpIsEmpty, | 10 | checkTmpIsEmpty, |
11 | checkVideoFilesWereRemoved, | 11 | checkVideoFilesWereRemoved, |
12 | cleanupTests, | 12 | cleanupTests, |
@@ -1018,9 +1018,7 @@ describe('Test multiple servers', function () { | |||
1018 | .field('privacy', '1') | 1018 | .field('privacy', '1') |
1019 | .field('channelId', '1') | 1019 | .field('channelId', '1') |
1020 | 1020 | ||
1021 | const filePath = join(__dirname, '..', '..', 'fixtures', 'video_short.webm') | 1021 | await req.attach('videofile', buildAbsoluteFixturePath('video_short.webm')) |
1022 | |||
1023 | await req.attach('videofile', filePath) | ||
1024 | .expect(HttpStatusCode.OK_200) | 1022 | .expect(HttpStatusCode.OK_200) |
1025 | 1023 | ||
1026 | await waitJobs(servers) | 1024 | await waitJobs(servers) |