Skip to content
Snippets Groups Projects
Commit f8a3a535 authored by Malte Bauch's avatar Malte Bauch
Browse files

changed test case `Test_core_Get`, within `core_test.go`

Fixes: #157
parent d2a0f661
No related branches found
No related tags found
6 merge requests!246Develop,!245Develop into Master,!244Master into develop2 into master,!228Merge develop into stmakurz_http_server,!226Resolve "Unit-Test: Test_core_Get is not reliable",!138Develop
Pipeline #89667 passed
...@@ -63,6 +63,7 @@ func Test_core_Get(t *testing.T) { ...@@ -63,6 +63,7 @@ func Test_core_Get(t *testing.T) {
name string name string
args args args args
want []string want []string
length int
wantErr bool wantErr bool
}{ }{
{ {
...@@ -70,15 +71,28 @@ func Test_core_Get(t *testing.T) { ...@@ -70,15 +71,28 @@ func Test_core_Get(t *testing.T) {
args: args{ args: args{
ctx: context.Background(), ctx: context.Background(),
request: &pb.GetRequest{ request: &pb.GetRequest{
All: true, Pid: []string{
pndID,
},
}, },
}, },
length: 1,
want: []string{ want: []string{
pndID, pndID,
"test", "test",
"test", "test",
}, },
}, },
{
name: "getAll",
args: args{
ctx: context.Background(),
request: &pb.GetRequest{
All: true,
},
},
length: 2,
},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
...@@ -91,13 +105,19 @@ func Test_core_Get(t *testing.T) { ...@@ -91,13 +105,19 @@ func Test_core_Get(t *testing.T) {
return return
} }
got := []string{ if tt.name == "default" {
resp.Pnd[0].Id, got := []string{
resp.Pnd[0].Name, resp.Pnd[0].Id,
resp.Pnd[0].Description, 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) { length := len(resp.Pnd)
t.Errorf("core.Get() = %v, want %v", got, tt.want) if tt.length != length {
t.Errorf("core.Get() = %v, want %v", length, tt.length)
} }
}) })
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment