Revert "huskies: merge 566_story_gateway_ui_bot_configuration_page"
This reverts commit c28c86dbc6.
This commit is contained in:
@@ -1971,67 +1971,4 @@ enabled = false
|
|||||||
let resp = cli.delete("/gateway/agents/no-such-id").send().await;
|
let resp = cli.delete("/gateway/agents/no-such-id").send().await;
|
||||||
assert_eq!(resp.0.status(), StatusCode::NOT_FOUND);
|
assert_eq!(resp.0.status(), StatusCode::NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Bot configuration helper tests ──────────────────────────────────
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn toml_string_plain() {
|
|
||||||
assert_eq!(toml_string("hello"), "\"hello\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn toml_string_escapes_quotes_and_backslashes() {
|
|
||||||
assert_eq!(toml_string(r#"say "hi""#), r#""say \"hi\"""#);
|
|
||||||
assert_eq!(toml_string(r"a\b"), r#""a\\b""#);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn write_and_read_matrix_bot_config_round_trips() {
|
|
||||||
let tmp = tempfile::tempdir().unwrap();
|
|
||||||
let payload = BotConfigPayload {
|
|
||||||
transport: "matrix".into(),
|
|
||||||
homeserver: Some("https://matrix.example.com".into()),
|
|
||||||
username: Some("@bot:example.com".into()),
|
|
||||||
password: Some("s3cr3t".into()),
|
|
||||||
slack_bot_token: None,
|
|
||||||
slack_signing_secret: None,
|
|
||||||
};
|
|
||||||
write_bot_config(tmp.path(), &payload).expect("write should succeed");
|
|
||||||
|
|
||||||
let read = read_bot_config_raw(tmp.path());
|
|
||||||
assert_eq!(read.transport, "matrix");
|
|
||||||
assert_eq!(
|
|
||||||
read.homeserver.as_deref(),
|
|
||||||
Some("https://matrix.example.com")
|
|
||||||
);
|
|
||||||
assert_eq!(read.username.as_deref(), Some("@bot:example.com"));
|
|
||||||
assert_eq!(read.password.as_deref(), Some("s3cr3t"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn write_and_read_slack_bot_config_round_trips() {
|
|
||||||
let tmp = tempfile::tempdir().unwrap();
|
|
||||||
let payload = BotConfigPayload {
|
|
||||||
transport: "slack".into(),
|
|
||||||
homeserver: None,
|
|
||||||
username: None,
|
|
||||||
password: None,
|
|
||||||
slack_bot_token: Some("xoxb-abc123".into()),
|
|
||||||
slack_signing_secret: Some("sig-secret".into()),
|
|
||||||
};
|
|
||||||
write_bot_config(tmp.path(), &payload).expect("write should succeed");
|
|
||||||
|
|
||||||
let read = read_bot_config_raw(tmp.path());
|
|
||||||
assert_eq!(read.transport, "slack");
|
|
||||||
assert_eq!(read.slack_bot_token.as_deref(), Some("xoxb-abc123"));
|
|
||||||
assert_eq!(read.slack_signing_secret.as_deref(), Some("sig-secret"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn read_bot_config_raw_returns_default_when_file_absent() {
|
|
||||||
let tmp = tempfile::tempdir().unwrap();
|
|
||||||
let read = read_bot_config_raw(tmp.path());
|
|
||||||
assert_eq!(read.transport, "");
|
|
||||||
assert!(read.homeserver.is_none());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user