mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 18:16:17 +01:00
fix: activitypub tests
This commit is contained in:
@@ -11,6 +11,7 @@ const request = require('../src/request');
|
||||
|
||||
const file = require('../src/file');
|
||||
const install = require('../src/install');
|
||||
const privileges = require('../src/privileges');
|
||||
const meta = require('../src/meta');
|
||||
const user = require('../src/user');
|
||||
const categories = require('../src/categories');
|
||||
@@ -358,9 +359,12 @@ describe('ActivityPub integration', () => {
|
||||
assert(saved.tid);
|
||||
|
||||
topic = await topics.getTopicData(saved.tid);
|
||||
assert(topic);
|
||||
assert.strictEqual(saved.uid, 'https://example.org/user/foobar');
|
||||
assert.strictEqual(saved.content, '<b>Baz quux</b>');
|
||||
const { uid, mainPid } = topic;
|
||||
assert(uid && mainPid);
|
||||
const { content, sourceContent } = await posts.getPostData(mainPid);
|
||||
assert.strictEqual(uid, 'https://example.org/user/foobar');
|
||||
assert.strictEqual(content, '');
|
||||
assert.strictEqual(sourceContent, '**Baz quux**');
|
||||
});
|
||||
|
||||
it('should properly save the topic title in the topic hash', async () => {
|
||||
@@ -501,7 +505,7 @@ describe('ActivityPub integration', () => {
|
||||
|
||||
it('should return true if successfully asserted', async () => {
|
||||
const result = await activitypub.actors.assert([actorUri]);
|
||||
assert(result);
|
||||
assert(result && result.length);
|
||||
});
|
||||
|
||||
it('should contain a representation of that remote user in the database', async () => {
|
||||
|
||||
@@ -34,12 +34,12 @@ describe('WebFinger endpoint', () => {
|
||||
});
|
||||
|
||||
it('should return 403 Forbidden if the calling user is not allowed to view the user list/profiles', async () => {
|
||||
await privileges.global.rescind(['groups:view:users'], 'guests');
|
||||
await privileges.global.rescind(['groups:view:users'], 'fediverse');
|
||||
const { response } = await request.get(`${nconf.get('url')}/.well-known/webfinger?resource=acct%3a${slug}%40${host}`);
|
||||
|
||||
assert(response);
|
||||
assert.strictEqual(response.statusCode, 400);
|
||||
await privileges.global.give(['groups:view:users'], 'guests');
|
||||
await privileges.global.give(['groups:view:users'], 'fediverse');
|
||||
});
|
||||
|
||||
it('should return a valid WebFinger response otherwise', async () => {
|
||||
|
||||
@@ -246,6 +246,7 @@ async function giveDefaultGlobalPrivileges() {
|
||||
await privileges.global.give([
|
||||
'groups:view:users', 'groups:view:tags', 'groups:view:groups',
|
||||
], 'guests');
|
||||
await privileges.global.give(['groups:view:users'], 'fediverse');
|
||||
}
|
||||
|
||||
async function enableDefaultPlugins() {
|
||||
|
||||
Reference in New Issue
Block a user