mirror of
https://github.com/luscis/openlan.git
synced 2025-09-26 20:41:29 +08:00
32 lines
565 B
Go
32 lines
565 B
Go
package cache
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/luscis/openlan/pkg/config"
|
|
"github.com/luscis/openlan/pkg/libol"
|
|
"github.com/luscis/openlan/pkg/models"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
type SocketClientMock struct {
|
|
libol.SocketClientImpl
|
|
}
|
|
|
|
func (s *SocketClientMock) String() string {
|
|
return "fake"
|
|
}
|
|
|
|
func TestInit(t *testing.T) {
|
|
cfg := &config.Perf{}
|
|
cfg.Correct()
|
|
Init(cfg)
|
|
fmt.Println(Access)
|
|
Access.Add(&models.Access{
|
|
UUID: "fake",
|
|
Client: &SocketClientMock{},
|
|
})
|
|
assert.Equal(t, 1, Access.Clients.Len(), "MUST be same")
|
|
}
|