func TestPolicyOperator_AddPolicies(t *testing.T) {
	ctl := gomock.NewController(t)
	defer ctl.Finish()
	e := mocks.NewMockIDistributedEnforcer(ctl)
	dir, err := ioutil.TempDir("", "casbin-hraft-")
	assert.NoError(t, err)
	defer os.RemoveAll(dir)
	p, err := NewPolicyOperator(zap.NewExample(), dir, e)
	assert.NoError(t, err)
	e.EXPECT().AddPoliciesSelf(nil, "p", "p", [][]string{{"role:admin", "/", "*"}, {"role:user", "/", "GET"}}).Return([][]string{{"role:admin", "/", "*"}, {"role:user", "/", "GET"}}, nil)
	err = p.AddPolicies("p", "p", [][]string{{"role:admin", "/", "*"}, {"role:user", "/", "GET"}})
	assert.NoError(t, err)
}
go:generate mockgen -destination ./mocks/mock_distributed_enforcer.go -package mocks github.com/casbin/casbin/v2 IDistributedEnforcer
package store
import (
	"bytes"
	"io/ioutil"
	"os"
	"path"
	"testing"
	"go.uber.org/zap"
	"github.com/casbin/hraft-dispatcher/store/mocks"
	"github.com/golang/mock/gomock"
	"github.com/stretchr/testify/assert"
)