MCPcopy
hub / github.com/grpc/grpc-go / TestAuthInfoFromPeer

Method TestAuthInfoFromPeer

credentials/alts/utils_test.go:74–100  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func (s) TestAuthInfoFromPeer(t *testing.T) {
75 altsAuthInfo := &fakeALTSAuthInfo{}
76 p := &peer.Peer{
77 AuthInfo: altsAuthInfo,
78 }
79 for _, tc := range []struct {
80 desc string
81 p *peer.Peer
82 success bool
83 out AuthInfo
84 }{
85 {
86 "working case",
87 p,
88 true,
89 altsAuthInfo,
90 },
91 } {
92 authInfo, err := AuthInfoFromPeer(tc.p)
93 if got, want := (err == nil), tc.success; got != want {
94 t.Errorf("%v: AuthInfoFromPeer(_)=(err=nil)=%v, want %v", tc.desc, got, want)
95 }
96 if got, want := authInfo, tc.out; got != want {
97 t.Errorf("%v:, AuthInfoFromPeer(_)=(%v, _), want (%v, _)", tc.desc, got, want)
98 }
99 }
100}
101
102func (s) TestClientAuthorizationCheck(t *testing.T) {
103 ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)

Callers

nothing calls this directly

Calls 2

AuthInfoFromPeerFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected