diff --git a/controller/api/auth_test.go b/controller/api/auth_test.go index c1e7a24a032919bd6d839922c647dc5e436cfb70..35669b3b7266b85b34e0d0ea6285c3c27fbf2a22 100644 --- a/controller/api/auth_test.go +++ b/controller/api/auth_test.go @@ -2,7 +2,6 @@ package api import ( "context" - "reflect" "testing" apb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/rbac" @@ -62,8 +61,18 @@ func TestLogout(t *testing.T) { want *apb.LogoutResponse wantErr bool }{ - // TODO: Add test cases. - // Not implemented yet! + { + name: "default log out", + args: args{ + ctx: context.TODO(), + addr: testAPIEndpoint, + username: "testAdmin", + }, + want: &apb.LogoutResponse{ + Status: apb.Status_STATUS_OK, + }, + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -72,8 +81,9 @@ func TestLogout(t *testing.T) { t.Errorf("Logout() error = %v, wantErr %v", err, tt.wantErr) return } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("Logout() = %v, want %v", got, tt.want) + + if got != nil && got.Status != tt.want.Status { + t.Errorf("Role.CreateRoles() = %v, want %v", got, tt.want) } }) } diff --git a/controller/northbound/server/auth_test.go b/controller/northbound/server/auth_test.go index 83f8d1221bced5cd4fb1c26b964f85cf22b40212..0c25776247e69ae087ced41f22f6be073515baef 100644 --- a/controller/northbound/server/auth_test.go +++ b/controller/northbound/server/auth_test.go @@ -2,7 +2,6 @@ package server import ( "context" - "reflect" "testing" apb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/rbac" @@ -75,9 +74,21 @@ func TestAuth_Logout(t *testing.T) { want *apb.LogoutResponse wantErr bool }{ - // TODO: Add test cases. - // Implement after session hdanling was added + { + name: "default log out", + args: args{ + ctx: context.TODO(), + request: &apb.LogoutRequest{ + Username: "testAdmin", + }, + }, + want: &apb.LogoutResponse{ + Status: apb.Status_STATUS_OK, + }, + wantErr: false, + }, } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { s := Auth{} @@ -86,8 +97,9 @@ func TestAuth_Logout(t *testing.T) { t.Errorf("Auth.Logout() error = %v, wantErr %v", err, tt.wantErr) return } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("Auth.Logout() = %v, want %v", got, tt.want) + + if got != nil && got.Status != tt.want.Status { + t.Errorf("Role.CreateRoles() = %v, want %v", got, tt.want) } }) }