mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
test: seed auto-reply auth profiles through store
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
expectBareNewOrResetAcknowledged,
|
||||
withTempHome,
|
||||
} from "../../test/helpers/auto-reply/trigger-handling-test-harness.js";
|
||||
import { saveAuthProfileStore } from "../agents/auth-profiles/store.js";
|
||||
import { loadSessionStore, resolveSessionKey } from "../config/sessions.js";
|
||||
import { registerGroupIntroPromptCases } from "./reply.triggers.group-intro-prompts.cases.js";
|
||||
import { registerTriggerHandlingUsageSummaryCases } from "./reply.triggers.trigger-handling.filters-usage-summary-current-model-provider.cases.js";
|
||||
@@ -770,41 +771,30 @@ describe("trigger handling", () => {
|
||||
runEmbeddedAgentMock.mockReset();
|
||||
const storePath = requireSessionStorePath(cfg);
|
||||
const authDir = join(home, ".openclaw", "agents", "main", "agent");
|
||||
await fs.mkdir(authDir, { recursive: true });
|
||||
await fs.writeFile(
|
||||
join(authDir, "auth-profiles.json"),
|
||||
JSON.stringify(
|
||||
{
|
||||
version: 1,
|
||||
profiles: {
|
||||
[TEST_PRIMARY_PROFILE_ID]: {
|
||||
type: "oauth",
|
||||
provider: "openai",
|
||||
access: "oauth-access-token-josh",
|
||||
},
|
||||
[TEST_SECONDARY_PROFILE_ID]: {
|
||||
type: "oauth",
|
||||
provider: "openai",
|
||||
access: "oauth-access-token",
|
||||
},
|
||||
saveAuthProfileStore(
|
||||
{
|
||||
version: 1,
|
||||
profiles: {
|
||||
[TEST_PRIMARY_PROFILE_ID]: {
|
||||
type: "oauth",
|
||||
provider: "openai",
|
||||
access: "oauth-access-token-josh",
|
||||
refresh: "oauth-refresh-token-josh",
|
||||
expires: Date.now() + 60_000,
|
||||
},
|
||||
[TEST_SECONDARY_PROFILE_ID]: {
|
||||
type: "oauth",
|
||||
provider: "openai",
|
||||
access: "oauth-access-token",
|
||||
refresh: "oauth-refresh-token",
|
||||
expires: Date.now() + 60_000,
|
||||
},
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
);
|
||||
await fs.writeFile(
|
||||
join(authDir, "auth-state.json"),
|
||||
JSON.stringify(
|
||||
{
|
||||
version: 1,
|
||||
order: {
|
||||
openai: [TEST_PRIMARY_PROFILE_ID],
|
||||
},
|
||||
order: {
|
||||
openai: [TEST_PRIMARY_PROFILE_ID],
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
},
|
||||
authDir,
|
||||
);
|
||||
|
||||
const slashSessionKey = "telegram:slash:111";
|
||||
|
||||
Reference in New Issue
Block a user