MCPcopy Create free account
hub / github.com/clouditor/clouditor / TestSession_HandleResponse

Function TestSession_HandleResponse

cli/session_test.go:89–137  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func TestSession_HandleResponse(t *testing.T) {
90 type fields struct {
91 URL string
92 Token oauth2.Token
93 Folder string
94 ClientConn *grpc.ClientConn
95 }
96 type args struct {
97 msg proto.Message
98 err error
99 }
100 tests := []struct {
101 name string
102 fields fields
103 args args
104 wantErr assert.ErrorAssertionFunc
105 }{
106 {
107 name: "grpc Error",
108 args: args{
109 msg: nil,
110 err: status.Errorf(codes.Internal, "internal error occurred!"),
111 },
112 wantErr: func(t assert.TestingT, err error, i ...interface{}) bool {
113 return assert.Error(t, err)
114 },
115 },
116 {
117 name: "non-grpc error",
118 args: args{
119 msg: nil,
120 err: fmt.Errorf("random error"),
121 },
122 wantErr: func(t assert.TestingT, err error, i ...interface{}) bool {
123 return assert.Error(t, err)
124 },
125 },
126 }
127 for _, tt := range tests {
128 t.Run(tt.name, func(t *testing.T) {
129 s := &cli.Session{
130 URL: tt.fields.URL,
131 Folder: tt.fields.Folder,
132 ClientConn: tt.fields.ClientConn,
133 }
134 tt.wantErr(t, s.HandleResponse(tt.args.msg, tt.args.err), fmt.Sprintf("HandleResponse(%v, %v)", tt.args.msg, tt.args.err))
135 })
136 }
137}
138
139func TestValidArgsGetMetrics(t *testing.T) {
140 type args struct {

Callers

nothing calls this directly

Calls 2

HandleResponseMethod · 0.95
ErrorfMethod · 0.80

Tested by

no test coverage detected