+ it('Should succeed with a valid HTTP signature', async function () {
+ const body = activityPubContextify(getAnnounceWithoutContext(servers[1]))
+ const headers = buildGlobalHeaders(body)
+
+ const { statusCode } = await makePOSTAPRequest(url, body, baseHttpSignature(), headers)
+ expect(statusCode).to.equal(HttpStatusCode.NO_CONTENT_204)
+ })
+
+ it('Should refresh the actor keys', async function () {
+ this.timeout(20000)
+
+ // Update keys of server 2 to invalid keys
+ // Server 1 should refresh the actor and fail
+ await setKeysOfServer(servers[1], servers[1], invalidKeys.publicKey, invalidKeys.privateKey)
+ await setUpdatedAtOfServer(servers[0], servers[1], '2015-07-17 22:00:00+00')
+
+ // Invalid peertube actor cache
+ await killallServers([ servers[1] ])
+ await servers[1].run()
+
+ const body = activityPubContextify(getAnnounceWithoutContext(servers[1]))
+ const headers = buildGlobalHeaders(body)
+
+ try {
+ await makePOSTAPRequest(url, body, baseHttpSignature(), headers)
+ expect(true, 'Did not throw').to.be.false
+ } catch (err) {
+ console.error(err)
+ expect(err.statusCode).to.equal(HttpStatusCode.FORBIDDEN_403)
+ }