mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 10:41:25 +00:00
Tests: update onboard credential expectations for explicit ref mode
This commit is contained in:
committed by
Peter Steinberger
parent
b50d2ce93c
commit
09c7cb5d34
@@ -19,13 +19,29 @@ describe("onboard auth credentials secret refs", () => {
|
|||||||
await lifecycle.cleanup();
|
await lifecycle.cleanup();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("stores env-backed moonshot key as keyRef", async () => {
|
it("keeps env-backed moonshot key as plaintext by default", async () => {
|
||||||
const env = await setupAuthTestEnv("openclaw-onboard-auth-credentials-");
|
const env = await setupAuthTestEnv("openclaw-onboard-auth-credentials-");
|
||||||
lifecycle.setStateDir(env.stateDir);
|
lifecycle.setStateDir(env.stateDir);
|
||||||
process.env.MOONSHOT_API_KEY = "sk-moonshot-env";
|
process.env.MOONSHOT_API_KEY = "sk-moonshot-env";
|
||||||
|
|
||||||
await setMoonshotApiKey("sk-moonshot-env");
|
await setMoonshotApiKey("sk-moonshot-env");
|
||||||
|
|
||||||
|
const parsed = await readAuthProfilesForAgent<{
|
||||||
|
profiles?: Record<string, { key?: string; keyRef?: unknown }>;
|
||||||
|
}>(env.agentDir);
|
||||||
|
expect(parsed.profiles?.["moonshot:default"]).toMatchObject({
|
||||||
|
key: "sk-moonshot-env",
|
||||||
|
});
|
||||||
|
expect(parsed.profiles?.["moonshot:default"]?.keyRef).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("stores env-backed moonshot key as keyRef in ref mode", async () => {
|
||||||
|
const env = await setupAuthTestEnv("openclaw-onboard-auth-credentials-ref-");
|
||||||
|
lifecycle.setStateDir(env.stateDir);
|
||||||
|
process.env.MOONSHOT_API_KEY = "sk-moonshot-env";
|
||||||
|
|
||||||
|
await setMoonshotApiKey("sk-moonshot-env", env.agentDir, { secretInputMode: "ref" });
|
||||||
|
|
||||||
const parsed = await readAuthProfilesForAgent<{
|
const parsed = await readAuthProfilesForAgent<{
|
||||||
profiles?: Record<string, { key?: string; keyRef?: unknown }>;
|
profiles?: Record<string, { key?: string; keyRef?: unknown }>;
|
||||||
}>(env.agentDir);
|
}>(env.agentDir);
|
||||||
@@ -71,7 +87,9 @@ describe("onboard auth credentials secret refs", () => {
|
|||||||
lifecycle.setStateDir(env.stateDir);
|
lifecycle.setStateDir(env.stateDir);
|
||||||
process.env.CLOUDFLARE_AI_GATEWAY_API_KEY = "cf-secret";
|
process.env.CLOUDFLARE_AI_GATEWAY_API_KEY = "cf-secret";
|
||||||
|
|
||||||
await setCloudflareAiGatewayConfig("account-1", "gateway-1", "cf-secret");
|
await setCloudflareAiGatewayConfig("account-1", "gateway-1", "cf-secret", env.agentDir, {
|
||||||
|
secretInputMode: "ref",
|
||||||
|
});
|
||||||
|
|
||||||
const parsed = await readAuthProfilesForAgent<{
|
const parsed = await readAuthProfilesForAgent<{
|
||||||
profiles?: Record<string, { key?: string; keyRef?: unknown; metadata?: unknown }>;
|
profiles?: Record<string, { key?: string; keyRef?: unknown; metadata?: unknown }>;
|
||||||
|
|||||||
Reference in New Issue
Block a user