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

Function TestTeamAccountIDFromRequest

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

Source from the content-addressed store, hash-verified

29}
30
31func 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
57func TestAuthorizationTokenAndTeam(t *testing.T) {
58 gin.SetMode(gin.TestMode)

Callers

nothing calls this directly

Calls 2

testContextWithHeadersFunction · 0.85
teamAccountIDFromRequestFunction · 0.85

Tested by

no test coverage detected