(t *testing.T)
| 55 | } |
| 56 | |
| 57 | func TestAuthorizationTokenAndTeam(t *testing.T) { |
| 58 | gin.SetMode(gin.TestMode) |
| 59 | |
| 60 | headerContext := testContextWithHeaders(map[string]string{ |
| 61 | "Authorization": "Bearer refresh-token", |
| 62 | "ChatGPT-Account-ID": "team-from-header", |
| 63 | }) |
| 64 | token, teamID, hasAuthorizationTeamID := authorizationTokenAndTeam(headerContext) |
| 65 | if token != "refresh-token" { |
| 66 | t.Fatalf("token = %q, want %q", token, "refresh-token") |
| 67 | } |
| 68 | if teamID != "team-from-header" { |
| 69 | t.Fatalf("teamID = %q, want %q", teamID, "team-from-header") |
| 70 | } |
| 71 | if hasAuthorizationTeamID { |
| 72 | t.Fatalf("hasAuthorizationTeamID = true, want false") |
| 73 | } |
| 74 | |
| 75 | authContext := testContextWithHeaders(map[string]string{ |
| 76 | "Authorization": "Bearer refresh-token,team-from-auth", |
| 77 | }) |
| 78 | token, teamID, hasAuthorizationTeamID = authorizationTokenAndTeam(authContext) |
| 79 | if token != "refresh-token" { |
| 80 | t.Fatalf("token = %q, want %q", token, "refresh-token") |
| 81 | } |
| 82 | if teamID != "team-from-auth" { |
| 83 | t.Fatalf("teamID = %q, want %q", teamID, "team-from-auth") |
| 84 | } |
| 85 | if !hasAuthorizationTeamID { |
| 86 | t.Fatalf("hasAuthorizationTeamID = false, want true") |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | func TestWriteChatCompletionStreamDoneAddsStopBeforeDone(t *testing.T) { |
| 91 | gin.SetMode(gin.TestMode) |
nothing calls this directly
no test coverage detected