Skip to content
Snippets Groups Projects
Commit 39e22b53 authored by Fabian Seidl's avatar Fabian Seidl
Browse files

fixed get Pnd test to fit new api

parent 3b692861
No related branches found
No related tags found
1 merge request!238Stfaseid http refactor
Pipeline #96495 failed
package server
import (
"context"
"os"
"reflect"
"testing"
"time"
pb "code.fbi.h-da.de/danet/api/go/gosdn/core"
ppb "code.fbi.h-da.de/danet/api/go/gosdn/pnd"
spb "code.fbi.h-da.de/danet/api/go/gosdn/southbound"
"code.fbi.h-da.de/danet/api/go/gosdn/transport"
......@@ -171,59 +174,52 @@ func TestMain(m *testing.M) {
func Test_pnd_Get(t *testing.T) {
removeExistingStores()
// type args struct {
// ctx context.Context
// request *ppb.GetRequest
// }
// tests := []struct {
// name string
// args args
// want []string
// wantErr bool
// }{
// {
// name: "get pnd",
// args: args{
// ctx: context.Background(),
// request: &ppb.GetRequest{
// Request: &ppb.GetRequest_Pnd{
// Pnd: &ppb.GetPnd{},
// },
// Pid: pndID,
// },
// },
// want: []string{
// pndID,
// ondID,
// sbiID,
// // pendingChangeID,
// // committedChangeID,
// },
// },
// }
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// p := pndServer{
// UnimplementedPndServiceServer: ppb.UnimplementedPndServiceServer{},
// }
// resp, err := p.Get(tt.args.ctx, tt.args.request)
// if (err != nil) != tt.wantErr {
// t.Errorf("Get() error = %v, wantErr %v", err, tt.wantErr)
// return
// }
type args struct {
ctx context.Context
request *pb.GetPndRequest
}
tests := []struct {
name string
args args
want pb.GetPndResponse
wantErr bool
}{
{
name: "get pnd",
args: args{
ctx: context.Background(),
request: &pb.GetPndRequest{
Pid: []string{
pndID},
},
},
want: pb.GetPndResponse{
Pnd: []*ppb.PrincipalNetworkDomain{
{Id: pndID,
Name: "test",
Description: "test"},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
p := core{
UnimplementedCoreServiceServer: pb.UnimplementedCoreServiceServer{},
}
resp, err := p.GetPnd(tt.args.ctx, tt.args.request)
if (err != nil) != tt.wantErr {
t.Errorf("Get() error = %v, wantErr %v", err, tt.wantErr)
return
}
// got := []string{
// resp.Pnd.Id,
// resp.Pnd.Ond[0].Id,
// resp.Pnd.Sbi[0].Id,
// // resp.Pnd.Change[0].Id,
// // resp.Pnd.Change[1].Id,
// }
// if !reflect.DeepEqual(got, tt.want) {
// t.Errorf("Get() got = %v, want %v", got, tt.want)
// }
// })
// }
got := resp.GetPnd()
if !reflect.DeepEqual(got, tt.want.Pnd) {
t.Errorf("Get() got = %v, want %v", got, tt.want.Pnd)
}
})
}
}
func Test_pnd_Set(t *testing.T) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment