github.com/TechnimalCoLtd/hmq@v0.0.1/plugins/auth/authfile/acl_test.go (about) 1 //+build test 2 3 package acl 4 5 import ( 6 "os" 7 "testing" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestOrigAcls(t *testing.T) { 13 pwd, _ := os.Getwd() 14 os.Chdir("../../../") 15 aclOrig := Init() 16 os.Chdir(pwd) 17 18 // rule: allow ip 127.0.0.1 2 $SYS/# 19 origAllowed := aclOrig.CheckACL(PUB, "dummyClientID", "dummyUser", "127.0.0.1", "$SYS/something") 20 assert.True(t, origAllowed) 21 origAllowed = aclOrig.CheckACL(SUB, "dummyClientID", "dummyUser", "127.0.0.1", "$SYS/something") 22 assert.False(t, origAllowed) 23 }