mirror of
https://github.com/the-draupnir-project/Draupnir.git
synced 2026-05-14 11:25:11 +00:00
781d55db8b
Tests / Build & Lint (push) Failing after 2m41s
Tests / Unit tests (push) Successful in 2m58s
Tests / Integration tests (push) Failing after 21s
Tests / Application Service Integration tests (push) Failing after 11s
GHCR - Development Branches / ghcr-publish (push) Failing after 12m54s
Docker Hub - Develop / docker-latest (push) Failing after 13m51s
Starts us down the path of fixing https://github.com/the-draupnir-project/Draupnir/issues/1023
This PR gets us Zero Touch Provisioning support for AS mode and Bot mode. If your env can take usr and pswd and turn it into access tokens or however you want to do that then well we dont need to do PSWD Auth at all.
If you dont PSWD auth is useful for this and is probably what i will resort to in mdad for Zero Touch Provisioning.
Draft as this PR is very much not even mx-tested because mx-tester decided to say nope cat.
* Zero Touch Provisioning Support
* Update Account data keys to Gnuxie Suggested Values
Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
* Refine ZTD
Co-authored-by: Gnuxie <Gnuxie@users.noreply.github.com>
* Refine Config validation
* Run Prettier
* Fix Test Linting
* Refine ZTD Branch by removing leftover config values.
* Remove fallback management room value as it breaks ZTP
* Fix config validation having Truthy problems
* Fix dangling import.
* Fix config validation error.
* Revert "Fix config validation error."
This reverts commit c313dcbb52.
* Remove fake cast on config.initialManager
* note only available in develop while we fix shit
* Stop tests from accessing config.managementRoom directly.
---------
Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
Co-authored-by: Gnuxie <Gnuxie@users.noreply.github.com>
Co-authored-by: gnuxie <Gnuxie@protonmail.com>
60 lines
2.0 KiB
TypeScript
60 lines
2.0 KiB
TypeScript
// Copyright 2022 - 2024 Gnuxie <Gnuxie@protonmail.com>
|
|
// Copyright 2021 - 2022 The Matrix.org Foundation C.I.C.
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
// SPDX-FileAttributionText: <text>
|
|
// This modified file incorporates work from mjolnir
|
|
// https://github.com/matrix-org/mjolnir
|
|
// </text>
|
|
|
|
import { MatrixClient } from "@vector-im/matrix-bot-sdk";
|
|
import { newTestUser, noticeListener } from "./clientHelper";
|
|
import { DraupnirTestContext } from "./mjolnirSetupUtils";
|
|
import { SafeMatrixEmitterWrapper } from "matrix-protection-suite-for-matrix-bot-sdk";
|
|
import { DefaultEventDecoder } from "matrix-protection-suite";
|
|
|
|
describe("Test: !help command", function (this: Mocha.Suite) {
|
|
let client: MatrixClient;
|
|
this.beforeEach(async function (this: DraupnirTestContext) {
|
|
client = await newTestUser(this.config.homeserverUrl, {
|
|
name: { contains: "-" },
|
|
});
|
|
await client.start();
|
|
} as unknown as Mocha.AsyncFunc);
|
|
this.afterEach(async function (this: DraupnirTestContext) {
|
|
client.stop();
|
|
} as unknown as Mocha.AsyncFunc);
|
|
it("Draupnir responded to !mjolnir help", async function (
|
|
this: DraupnirTestContext
|
|
) {
|
|
this.timeout(30000);
|
|
// send a messgage
|
|
const draupnir = this.draupnir;
|
|
const clientEmitter = new SafeMatrixEmitterWrapper(
|
|
client,
|
|
DefaultEventDecoder
|
|
);
|
|
if (draupnir === undefined) {
|
|
throw new TypeError(`setup code is wrong`);
|
|
}
|
|
await client.joinRoom(draupnir.managementRoomID);
|
|
// listener for getting the event reply
|
|
const reply = new Promise((resolve) => {
|
|
clientEmitter.on(
|
|
"room.message",
|
|
noticeListener(draupnir.managementRoomID, (event) => {
|
|
if (event.content.body.includes("which can be used")) {
|
|
resolve(event);
|
|
}
|
|
})
|
|
);
|
|
});
|
|
await client.sendMessage(draupnir.managementRoomID, {
|
|
msgtype: "m.text",
|
|
body: "!draupnir help",
|
|
});
|
|
await reply;
|
|
} as unknown as Mocha.AsyncFunc);
|
|
});
|