(t *testing.T)
| 42 | ) |
| 43 | |
| 44 | func (s) TestAuthInfoFromContext(t *testing.T) { |
| 45 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 46 | defer cancel() |
| 47 | altsAuthInfo := &fakeALTSAuthInfo{} |
| 48 | p := &peer.Peer{ |
| 49 | AuthInfo: altsAuthInfo, |
| 50 | } |
| 51 | for _, tc := range []struct { |
| 52 | desc string |
| 53 | ctx context.Context |
| 54 | success bool |
| 55 | out AuthInfo |
| 56 | }{ |
| 57 | { |
| 58 | "working case", |
| 59 | peer.NewContext(ctx, p), |
| 60 | true, |
| 61 | altsAuthInfo, |
| 62 | }, |
| 63 | } { |
| 64 | authInfo, err := AuthInfoFromContext(tc.ctx) |
| 65 | if got, want := (err == nil), tc.success; got != want { |
| 66 | t.Errorf("%v: AuthInfoFromContext(_)=(err=nil)=%v, want %v", tc.desc, got, want) |
| 67 | } |
| 68 | if got, want := authInfo, tc.out; got != want { |
| 69 | t.Errorf("%v:, AuthInfoFromContext(_)=(%v, _), want (%v, _)", tc.desc, got, want) |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | func (s) TestAuthInfoFromPeer(t *testing.T) { |
| 75 | altsAuthInfo := &fakeALTSAuthInfo{} |
nothing calls this directly
no test coverage detected