Skip to content

Commit c2560af

Browse files
committed
chore: Added testcases for nil responses
1 parent afaead9 commit c2560af

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

internal/cmd/redis/credentials/create/create_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ func Test_outputResult(t *testing.T) {
216216
args: args{model: inputModel{GlobalFlagModel: &globalflags.GlobalFlagModel{}}, resp: &redis.CredentialsResponse{}},
217217
wantErr: false,
218218
},
219+
{
220+
name: "nil response",
221+
args: args{model: inputModel{GlobalFlagModel: &globalflags.GlobalFlagModel{}}},
222+
wantErr: true,
223+
},
219224
}
220225
p := print.NewPrinter()
221226
p.Cmd = NewCmd(p)

internal/cmd/redis/credentials/describe/describe_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,11 @@ func Test_outputResult(t *testing.T) {
260260
},
261261
wantErr: false,
262262
},
263+
{
264+
name: "nil response",
265+
args: args{},
266+
wantErr: true,
267+
},
263268
}
264269
p := print.NewPrinter()
265270
p.Cmd = NewCmd(p)

internal/cmd/redis/instance/create/create_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,15 @@ func Test_outputResult(t *testing.T) {
485485
},
486486
wantErr: false,
487487
},
488+
{
489+
name: "nil response",
490+
args: args{
491+
model: &inputModel{GlobalFlagModel: &globalflags.GlobalFlagModel{}},
492+
projectLabel: "",
493+
instanceId: testMonitoringInstanceId,
494+
},
495+
wantErr: true,
496+
},
488497
}
489498
p := print.NewPrinter()
490499
p.Cmd = NewCmd(p)

internal/cmd/redis/instance/describe/describe_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ func Test_outputResult(t *testing.T) {
233233
},
234234
wantErr: false,
235235
},
236+
{
237+
name: "nil response",
238+
args: args{},
239+
wantErr: true,
240+
},
236241
{
237242
name: "nil parameter",
238243
args: args{

0 commit comments

Comments
 (0)