This commit is contained in:
Felix Ableitner 2024-11-26 12:04:40 +01:00
parent 1001e3f67a
commit ff2a7c5136
2 changed files with 13 additions and 17 deletions

View file

@ -34,6 +34,7 @@ import {
longDelay, longDelay,
editCommunity, editCommunity,
unfollows, unfollows,
allowInstance,
} from "./shared"; } from "./shared";
import { EditCommunity, EditSite } from "lemmy-js-client"; import { EditCommunity, EditSite } from "lemmy-js-client";
@ -455,9 +456,12 @@ test("Dont receive community activities after unsubscribe", async () => {
expect(communityRes1.community_view.counts.subscribers).toBe(2); expect(communityRes1.community_view.counts.subscribers).toBe(2);
// temporarily block alpha, so that it doesn't know about unfollow // temporarily block alpha, so that it doesn't know about unfollow
let editSiteForm: EditSite = {}; var allow_instance_params: AdminAllowInstanceParams = {
editSiteForm.allowed_instances = ["lemmy-epsilon"]; instance: "lemmy-alpha",
await beta.editSite(editSiteForm); allow: false,
reason: undefined,
};
await beta.adminAllowInstance(allow_instance_params);
await longDelay(); await longDelay();
// unfollow // unfollow
@ -471,8 +475,8 @@ test("Dont receive community activities after unsubscribe", async () => {
expect(communityRes2.community_view.counts.subscribers).toBe(2); expect(communityRes2.community_view.counts.subscribers).toBe(2);
// unblock alpha // unblock alpha
editSiteForm.allowed_instances = betaAllowedInstances; allow_instance_params.allow = true;
await beta.editSite(editSiteForm); await beta.adminAllowInstance(allow_instance_params);
await longDelay(); await longDelay();
// create a post, it shouldnt reach beta // create a post, it shouldnt reach beta

View file

@ -105,13 +105,6 @@ export const gamma = new LemmyHttp(gammaUrl, { fetchFunction });
export const delta = new LemmyHttp(deltaUrl, { fetchFunction }); export const delta = new LemmyHttp(deltaUrl, { fetchFunction });
export const epsilon = new LemmyHttp(epsilonUrl, { fetchFunction }); export const epsilon = new LemmyHttp(epsilonUrl, { fetchFunction });
export const betaAllowedInstances = [
"lemmy-alpha",
"lemmy-gamma",
"lemmy-delta",
"lemmy-epsilon",
];
const password = "lemmylemmy"; const password = "lemmylemmy";
export async function setupLogins() { export async function setupLogins() {
@ -175,7 +168,7 @@ export async function setupLogins() {
await delta.editSite(editSiteForm); await delta.editSite(editSiteForm);
await epsilon.editSite(editSiteForm); await epsilon.editSite(editSiteForm);
// Set the blocksfor each // Set the blocks for each
await allowInstance(alpha, "lemmy-beta"); await allowInstance(alpha, "lemmy-beta");
await allowInstance(alpha, "lemmy-gamma"); await allowInstance(alpha, "lemmy-gamma");
await allowInstance(alpha, "lemmy-delta"); await allowInstance(alpha, "lemmy-delta");
@ -209,12 +202,11 @@ export async function setupLogins() {
} }
} }
async function allowInstance( export async function allowInstance(api: LemmyHttp, instance: string) {
api: LemmyHttp,instance: string) { const params: AdminAllowInstanceParams = {
const params: AdminAllowInstanceParams = {
instance, instance,
allow: true, allow: true,
reason: undefined reason: undefined,
}; };
await api.adminAllowInstance(params); await api.adminAllowInstance(params);
} }