]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/activitypub/helpers.ts
Add ability to search by UUID
[github/Chocobozzz/PeerTube.git] / server / tests / api / activitypub / helpers.ts
index 4c42f3d67e6754dcc01c14ae1a598d5de1c7eb79..0d1f154fe5bc503b231271bd5cea1bfa6888537d 100644 (file)
@@ -2,7 +2,7 @@
 
 import 'mocha'
 import { expect } from 'chai'
-import { buildRequestStub } from '../../utils/miscs/stubs'
+import { buildRequestStub } from '../../../../shared/extra-utils/miscs/stubs'
 import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto'
 import { cloneDeep } from 'lodash'
 import { buildSignedActivity } from '../../../helpers/activitypub'
@@ -53,19 +53,6 @@ describe('Test activity pub helpers', function () {
       expect(result).to.be.false
     })
 
-    it('Should fail with an invalid PeerTube URL', async function () {
-      const keys = require('./json/peertube/keys.json')
-      const body = require('./json/peertube/announce-without-context.json')
-
-      const actorSignature = { url: 'http://localhost:9002/accounts/peertube', privateKey: keys.privateKey }
-      const signedBody = await buildSignedActivity(actorSignature as any, body)
-
-      const fromActor = { publicKey: keys.publicKey, url: 'http://localhost:9003/accounts/peertube' }
-      const result = await isJsonLDSignatureVerified(fromActor as any, signedBody)
-
-      expect(result).to.be.false
-    })
-
     it('Should succeed with a valid PeerTube signature', async function () {
       const keys = require('./json/peertube/keys.json')
       const body = require('./json/peertube/announce-without-context.json')
@@ -91,7 +78,7 @@ describe('Test activity pub helpers', function () {
       req.headers = mastodonObject.headers
       req.headers.signature = 'Signature ' + req.headers.signature
 
-      const parsed = parseHTTPSignature(req, 3600 * 365 * 3)
+      const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10)
       const publicKey = require('./json/mastodon/public-key.json').publicKey
 
       const actor = { publicKey }
@@ -110,7 +97,7 @@ describe('Test activity pub helpers', function () {
       req.headers = mastodonObject.headers
       req.headers.signature = 'Signature ' + req.headers.signature
 
-      const parsed = parseHTTPSignature(req, 3600 * 365 * 3)
+      const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10)
       const publicKey = require('./json/mastodon/bad-public-key.json').publicKey
 
       const actor = { publicKey }
@@ -150,7 +137,7 @@ describe('Test activity pub helpers', function () {
 
       let errored = false
       try {
-        parseHTTPSignature(req, 3600 * 365 * 3)
+        parseHTTPSignature(req, 3600 * 1000 * 365 * 10)
       } catch {
         errored = true
       }
@@ -168,7 +155,7 @@ describe('Test activity pub helpers', function () {
       req.headers = mastodonObject.headers
       req.headers.signature = 'Signature ' + req.headers.signature
 
-      const parsed = parseHTTPSignature(req, 3600 * 365 * 3)
+      const parsed = parseHTTPSignature(req, 3600 * 1000 * 365 * 10)
       const publicKey = require('./json/mastodon/public-key.json').publicKey
 
       const actor = { publicKey }