mirror of
https://github.com/fhmq/hmq.git
synced 2026-04-24 10:38:34 +00:00
* adding test + fix issue with wrong order in acl check * reduce to featureset from original fork
24 lines
533 B
Go
24 lines
533 B
Go
//+build test
|
|
|
|
package acl
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestOrigAcls(t *testing.T) {
|
|
pwd, _ := os.Getwd()
|
|
os.Chdir("../../../")
|
|
aclOrig := Init()
|
|
os.Chdir(pwd)
|
|
|
|
// rule: allow ip 127.0.0.1 2 $SYS/#
|
|
origAllowed := aclOrig.CheckACL(PUB, "dummyClientID", "dummyUser", "127.0.0.1", "$SYS/something")
|
|
assert.True(t, origAllowed)
|
|
origAllowed = aclOrig.CheckACL(SUB, "dummyClientID", "dummyUser", "127.0.0.1", "$SYS/something")
|
|
assert.False(t, origAllowed)
|
|
}
|