From 6cbdbdef1786aabb2003918fad6cd8c0d4433f7c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 30 Nov 2017 12:00:40 +0100 Subject: Check correctly activitypub headers --- server/tests/activitypub.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 server/tests/activitypub.ts (limited to 'server/tests/activitypub.ts') diff --git a/server/tests/activitypub.ts b/server/tests/activitypub.ts new file mode 100644 index 000000000..333e02e84 --- /dev/null +++ b/server/tests/activitypub.ts @@ -0,0 +1,42 @@ +/* tslint:disable:no-unused-expression */ + +import * as chai from 'chai' +import 'mocha' +import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from './utils' +import { runServer } from './utils/servers' +import { makeActivityPubGetRequest } from './utils/activitypub' + +const expect = chai.expect + +describe('Test activitypub', function () { + let server: ServerInfo = null + + before(async function () { + this.timeout(10000) + + await flushTests() + + server = await runServer(1) + + await setAccessTokensToServers([ server ]) + }) + + it('Should return the account object', async function () { + const res = await makeActivityPubGetRequest(server.url, '/account/root') + const object = res.body + + expect(object.type).to.equal('Person') + expect(object.id).to.equal('http://localhost:9001/account/root') + expect(object.name).to.equal('root') + expect(object.preferredUsername).to.equal('root') + }) + + after(async function () { + killallServers([ server ]) + + // Keep the logs if the test failed + if (this['ok']) { + await flushTests() + } + }) +}) -- cgit v1.2.3