fix(ai): align api key credentials with auth json
This commit is contained in:
@@ -225,7 +225,7 @@ describe("Models runtime", () => {
|
||||
expect(resolution?.source).toBe("OAuth");
|
||||
|
||||
// stored api-key credential resolves through apiKey auth, beats env
|
||||
await credentials.modify("p1", async () => ({ type: "api-key", key: "stored-key" }));
|
||||
await credentials.modify("p1", async () => ({ type: "api_key", key: "stored-key" }));
|
||||
const apiKeyResolution = await models.getAuth(model);
|
||||
expect(apiKeyResolution?.auth.apiKey).toBe("stored-key");
|
||||
expect(apiKeyResolution?.source).toBe("stored");
|
||||
|
||||
@@ -149,7 +149,7 @@ describe("envApiKeyAuth", () => {
|
||||
const stored = await auth.resolve({
|
||||
model,
|
||||
ctx: fakeAuthContext({ FIRST_KEY: "env" }),
|
||||
credential: { type: "api-key", key: "stored" },
|
||||
credential: { type: "api_key", key: "stored" },
|
||||
});
|
||||
expect(stored?.auth.apiKey).toBe("stored");
|
||||
expect(stored?.source).toBe("stored credential");
|
||||
@@ -170,7 +170,7 @@ describe("envApiKeyAuth", () => {
|
||||
},
|
||||
notify: () => {},
|
||||
});
|
||||
expect(credential).toEqual({ type: "api-key", key: "entered-key" });
|
||||
expect(credential).toEqual({ type: "api_key", key: "entered-key" });
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user