优化结构
This commit is contained in:
@@ -3,12 +3,12 @@ package server
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"kra/internal/biz/system"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"kra/internal/biz"
|
||||
"kra/internal/conf"
|
||||
"kra/internal/integration/runtimeconfig"
|
||||
websocketintegration "kra/internal/integration/websocket"
|
||||
@@ -19,13 +19,13 @@ import (
|
||||
)
|
||||
|
||||
type websocketAuthStub struct {
|
||||
claims *biz.AuthClaims
|
||||
claims *system.AuthClaims
|
||||
got string
|
||||
}
|
||||
|
||||
func (s *websocketAuthStub) AuthenticateToken(_ context.Context, token string) (*biz.TokenAuthentication, error) {
|
||||
func (s *websocketAuthStub) AuthenticateToken(_ context.Context, token string) (*system.TokenAuthentication, error) {
|
||||
s.got = token
|
||||
return &biz.TokenAuthentication{Claims: s.claims}, nil
|
||||
return &system.TokenAuthentication{Claims: s.claims}, nil
|
||||
}
|
||||
|
||||
var _ middleware.TokenAuthenticator = (*websocketAuthStub)(nil)
|
||||
@@ -43,7 +43,7 @@ func TestWebSocketRouteRequiresAndAcceptsLoginToken(t *testing.T) {
|
||||
}
|
||||
defer cleanup()
|
||||
|
||||
auth := &websocketAuthStub{claims: &biz.AuthClaims{ID: 7}}
|
||||
auth := &websocketAuthStub{claims: &system.AuthClaims{ID: 7}}
|
||||
engine := NewGinEngineWithRuntime(conf.NewRuntime(nil, &conf.AdminBackend{}), nil, auth, nil, nil, nil, "test", nil, ws)
|
||||
|
||||
unauthorized := httptest.NewRecorder()
|
||||
|
||||
Reference in New Issue
Block a user