diff --git a/northbound/server/core_test.go b/northbound/server/core_test.go index 19bcb0acb578f49beafc3cd405f495d27112f4ac..efe46fd2a5dc67a6bda83a5c019c95afe62a51e1 100644 --- a/northbound/server/core_test.go +++ b/northbound/server/core_test.go @@ -63,6 +63,7 @@ func Test_core_Get(t *testing.T) { name string args args want []string + length int wantErr bool }{ { @@ -70,15 +71,28 @@ func Test_core_Get(t *testing.T) { args: args{ ctx: context.Background(), request: &pb.GetRequest{ - All: true, + Pid: []string{ + pndID, + }, }, }, + length: 1, want: []string{ pndID, "test", "test", }, }, + { + name: "getAll", + args: args{ + ctx: context.Background(), + request: &pb.GetRequest{ + All: true, + }, + }, + length: 2, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -91,13 +105,19 @@ func Test_core_Get(t *testing.T) { return } - got := []string{ - resp.Pnd[0].Id, - resp.Pnd[0].Name, - resp.Pnd[0].Description, + if tt.name == "default" { + got := []string{ + resp.Pnd[0].Id, + resp.Pnd[0].Name, + resp.Pnd[0].Description, + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("core.Get() = %v, want %v", got, tt.want) + } } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("core.Get() = %v, want %v", got, tt.want) + length := len(resp.Pnd) + if tt.length != length { + t.Errorf("core.Get() = %v, want %v", length, tt.length) } }) }