(t *testing.T)
| 87 | } |
| 88 | |
| 89 | func 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 | |
| 139 | func TestValidArgsGetMetrics(t *testing.T) { |
| 140 | type args struct { |
nothing calls this directly
no test coverage detected