(t *testing.T)
| 29 | } |
| 30 | |
| 31 | func TestTeamAccountIDFromRequest(t *testing.T) { |
| 32 | gin.SetMode(gin.TestMode) |
| 33 | |
| 34 | headerContext := testContextWithHeaders(map[string]string{ |
| 35 | "Authorization": "Bearer access-token,team-from-auth", |
| 36 | "ChatGPT-Account-ID": "team-from-header", |
| 37 | }) |
| 38 | if got := teamAccountIDFromRequest(headerContext); got != "team-from-header" { |
| 39 | t.Fatalf("teamAccountIDFromRequest = %q, want %q", got, "team-from-header") |
| 40 | } |
| 41 | |
| 42 | authContext := testContextWithHeaders(map[string]string{ |
| 43 | "Authorization": "Bearer access-token,team-from-auth", |
| 44 | }) |
| 45 | if got := teamAccountIDFromRequest(authContext); got != "team-from-auth" { |
| 46 | t.Fatalf("teamAccountIDFromRequest = %q, want %q", got, "team-from-auth") |
| 47 | } |
| 48 | |
| 49 | emptyContext := testContextWithHeaders(map[string]string{ |
| 50 | "Authorization": "Bearer access-token", |
| 51 | }) |
| 52 | if got := teamAccountIDFromRequest(emptyContext); got != "" { |
| 53 | t.Fatalf("teamAccountIDFromRequest = %q, want empty", got) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | func TestAuthorizationTokenAndTeam(t *testing.T) { |
| 58 | gin.SetMode(gin.TestMode) |
nothing calls this directly
no test coverage detected