init bootstrap
This commit is contained in:
28
local/middleware/auth_test_exports.go
Normal file
28
local/middleware/auth_test_exports.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package middleware
|
||||
|
||||
import "context"
|
||||
|
||||
// ExportedCachedUserInfo exports CachedUserInfo for testing
|
||||
type ExportedCachedUserInfo = CachedUserInfo
|
||||
|
||||
// GetCachedUserInfo exports the internal getCachedUserInfo method for testing
|
||||
func (m *AuthMiddleware) GetCachedUserInfo(ctx context.Context, userID string) (*CachedUserInfo, error) {
|
||||
return m.getCachedUserInfo(ctx, userID)
|
||||
}
|
||||
|
||||
// TestExports provides test-only functionality for AuthMiddleware
|
||||
type TestExports struct {
|
||||
AuthMiddleware *AuthMiddleware
|
||||
}
|
||||
|
||||
// NewTestExports creates a new TestExports instance
|
||||
func NewTestExports(auth *AuthMiddleware) *TestExports {
|
||||
return &TestExports{
|
||||
AuthMiddleware: auth,
|
||||
}
|
||||
}
|
||||
|
||||
// HasPermissionFromCache exports the internal hasPermissionFromCache method for testing
|
||||
func (t *TestExports) HasPermissionFromCache(userInfo *CachedUserInfo, permission string) bool {
|
||||
return t.AuthMiddleware.hasPermissionFromCache(userInfo, permission)
|
||||
}
|
||||
Reference in New Issue
Block a user