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

fixed problem with accessing nil stores

parent 7e7e7ee3
Branches
No related tags found
1 merge request!287Implement data persisting for user management
Pipeline #99443 passed
...@@ -11,16 +11,12 @@ import ( ...@@ -11,16 +11,12 @@ import (
) )
func Test_auth_Login(t *testing.T) { func Test_auth_Login(t *testing.T) {
type fields struct {
UnimplementedAuthServiceServer apb.UnimplementedAuthServiceServer
}
type args struct { type args struct {
ctx context.Context ctx context.Context
request *apb.LoginRequest request *apb.LoginRequest
} }
tests := []struct { tests := []struct {
name string name string
fields fields
args args args args
want string want string
wantErr bool wantErr bool
...@@ -41,7 +37,7 @@ func Test_auth_Login(t *testing.T) { ...@@ -41,7 +37,7 @@ func Test_auth_Login(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
r := Auth{ r := Auth{
UnimplementedAuthServiceServer: tt.fields.UnimplementedAuthServiceServer, UnimplementedAuthServiceServer: apb.UnimplementedAuthServiceServer{},
jwtManager: jwt, jwtManager: jwt,
} }
resp, err := r.Login(tt.args.ctx, tt.args.request) resp, err := r.Login(tt.args.ctx, tt.args.request)
...@@ -63,7 +59,6 @@ func Test_auth_Login(t *testing.T) { ...@@ -63,7 +59,6 @@ func Test_auth_Login(t *testing.T) {
func Test_auth_Logout(t *testing.T) { func Test_auth_Logout(t *testing.T) {
type fields struct { type fields struct {
UnimplementedAuthServiceServer apb.UnimplementedAuthServiceServer UnimplementedAuthServiceServer apb.UnimplementedAuthServiceServer
jwt rbac.JWTManager
} }
type args struct { type args struct {
ctx context.Context ctx context.Context
...@@ -82,7 +77,6 @@ func Test_auth_Logout(t *testing.T) { ...@@ -82,7 +77,6 @@ func Test_auth_Logout(t *testing.T) {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
r := Auth{ r := Auth{
UnimplementedAuthServiceServer: tt.fields.UnimplementedAuthServiceServer, UnimplementedAuthServiceServer: tt.fields.UnimplementedAuthServiceServer,
jwtManager: &tt.fields.jwt,
} }
got, err := r.Logout(tt.args.ctx, tt.args.request) got, err := r.Logout(tt.args.ctx, tt.args.request)
if (err != nil) != tt.wantErr { if (err != nil) != tt.wantErr {
......
...@@ -15,6 +15,7 @@ import ( ...@@ -15,6 +15,7 @@ import (
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound" "code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound"
"code.fbi.h-da.de/danet/gosdn/controller/mocks" "code.fbi.h-da.de/danet/gosdn/controller/mocks"
"code.fbi.h-da.de/danet/gosdn/controller/nucleus" "code.fbi.h-da.de/danet/gosdn/controller/nucleus"
"code.fbi.h-da.de/danet/gosdn/controller/rbac"
"code.fbi.h-da.de/danet/yang-models/generated/openconfig" "code.fbi.h-da.de/danet/yang-models/generated/openconfig"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
...@@ -147,6 +148,9 @@ func TestMain(m *testing.M) { ...@@ -147,6 +148,9 @@ func TestMain(m *testing.M) {
log.Fatal(err) log.Fatal(err)
} }
userc = rbac.NewUserStore()
rolec = rbac.NewRoleStore()
os.Exit(m.Run()) os.Exit(m.Run())
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment