Skip to content

Commit 18234ea

Browse files
authored
test: refresh Anthropic auth fixtures (#129369)
Updated Anthropic auth tests to use a managed profile and completed provider-runtime mocks so the suites exercise current behavior.
1 parent 47ba4ab commit 18234ea

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎src/agents/auth-profiles/oauth.fallback-to-main-agent.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ describe("resolveApiKeyForProfile fallback to main agent", () => {
182182
}
183183

184184
it("falls back to main agent credentials when secondary agent token is expired and refresh fails", async () => {
185-
const profileId = "anthropic:claude-cli";
185+
const profileId = "anthropic:default";
186186
const now = Date.now();
187187
const expiredTime = now - 60 * 60 * 1000; // 1 hour ago
188188
const freshTime = now + 60 * 60 * 1000; // 1 hour from now
@@ -229,7 +229,7 @@ describe("resolveApiKeyForProfile fallback to main agent", () => {
229229
});
230230

231231
it("adopts newer OAuth token from main agent even when secondary token is still valid", async () => {
232-
const profileId = "anthropic:claude-cli";
232+
const profileId = "anthropic:default";
233233
const now = Date.now();
234234
const secondaryExpiry = now + 30 * 60 * 1000;
235235
const mainExpiry = now + 2 * 60 * 60 * 1000;
@@ -266,7 +266,7 @@ describe("resolveApiKeyForProfile fallback to main agent", () => {
266266
});
267267

268268
it("adopts main token when secondary expires is NaN/malformed", async () => {
269-
const profileId = "anthropic:claude-cli";
269+
const profileId = "anthropic:default";
270270
const now = Date.now();
271271
const mainExpiry = now + 2 * 60 * 60 * 1000;
272272

@@ -340,7 +340,7 @@ describe("resolveApiKeyForProfile fallback to main agent", () => {
340340
});
341341

342342
it("throws error when both secondary and main agent credentials are expired", async () => {
343-
const profileId = "anthropic:claude-cli";
343+
const profileId = "anthropic:default";
344344
const now = Date.now();
345345
const expiredTime = now - 60 * 60 * 1000; // 1 hour ago
346346

@@ -361,7 +361,7 @@ describe("resolveApiKeyForProfile fallback to main agent", () => {
361361
});
362362

363363
it("still falls back to main agent credentials when the refresh-token-reused retry throws", async () => {
364-
const profileId = "anthropic:claude-cli";
364+
const profileId = "anthropic:default";
365365
const now = Date.now();
366366
const expiredTime = now - 60 * 60 * 1000;
367367
const freshTime = now + 60 * 60 * 1000;

‎src/agents/model-auth.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ vi.mock("../plugins/provider-runtime.js", () => {
8585
return {
8686
buildProviderMissingAuthMessageWithPlugin: () => undefined,
8787
resolveExternalAuthProfilesWithPlugins: () => [],
88+
resolveProviderDeprecatedAuthProfileIds: () => [],
8889
shouldDeferProviderSyntheticProfileAuthWithPlugin: (params: {
8990
context?: { resolvedApiKey?: string };
9091
}) => params.context?.resolvedApiKey === "synthetic-defer",

‎src/agents/runtime-plan/prepare-auth.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
// coverage; keep those runtimes out of this focused planner test.
1616
vi.mock("../../plugins/provider-runtime.js", () => ({
1717
buildProviderMissingAuthMessageWithPlugin: () => undefined,
18+
resolveProviderDeprecatedAuthProfileIds: () => [],
1819
resolveProviderSyntheticAuthWithPlugin: () => undefined,
1920
shouldDeferProviderSyntheticProfileAuthWithPlugin: () => undefined,
2021
}));

0 commit comments

Comments
 (0)