mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +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 file = require('../src/file');
|
||||||
const install = require('../src/install');
|
const install = require('../src/install');
|
||||||
|
const privileges = require('../src/privileges');
|
||||||
const meta = require('../src/meta');
|
const meta = require('../src/meta');
|
||||||
const user = require('../src/user');
|
const user = require('../src/user');
|
||||||
const categories = require('../src/categories');
|
const categories = require('../src/categories');
|
||||||
@@ -358,9 +359,12 @@ describe('ActivityPub integration', () => {
|
|||||||
assert(saved.tid);
|
assert(saved.tid);
|
||||||
|
|
||||||
topic = await topics.getTopicData(saved.tid);
|
topic = await topics.getTopicData(saved.tid);
|
||||||
assert(topic);
|
const { uid, mainPid } = topic;
|
||||||
assert.strictEqual(saved.uid, 'https://example.org/user/foobar');
|
assert(uid && mainPid);
|
||||||
assert.strictEqual(saved.content, '<b>Baz quux</b>');
|
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 () => {
|
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 () => {
|
it('should return true if successfully asserted', async () => {
|
||||||
const result = await activitypub.actors.assert([actorUri]);
|
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 () => {
|
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 () => {
|
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}`);
|
const { response } = await request.get(`${nconf.get('url')}/.well-known/webfinger?resource=acct%3a${slug}%40${host}`);
|
||||||
|
|
||||||
assert(response);
|
assert(response);
|
||||||
assert.strictEqual(response.statusCode, 400);
|
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 () => {
|
it('should return a valid WebFinger response otherwise', async () => {
|
||||||
|
|||||||
@@ -246,6 +246,7 @@ async function giveDefaultGlobalPrivileges() {
|
|||||||
await privileges.global.give([
|
await privileges.global.give([
|
||||||
'groups:view:users', 'groups:view:tags', 'groups:view:groups',
|
'groups:view:users', 'groups:view:tags', 'groups:view:groups',
|
||||||
], 'guests');
|
], 'guests');
|
||||||
|
await privileges.global.give(['groups:view:users'], 'fediverse');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function enableDefaultPlugins() {
|
async function enableDefaultPlugins() {
|
||||||
|
|||||||
Reference in New Issue
Block a user