MCPcopy Create free account
hub / github.com/aurora-develop/aurora / TestAuthorizationTokenAndTeam

Function TestAuthorizationTokenAndTeam

initialize/handlers_test.go:57–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

55}
56
57func 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
90func TestWriteChatCompletionStreamDoneAddsStopBeforeDone(t *testing.T) {
91 gin.SetMode(gin.TestMode)

Callers

nothing calls this directly

Calls 2

testContextWithHeadersFunction · 0.85

Tested by

no test coverage detected