Initial commit
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package g
|
||||
|
||||
const (
|
||||
ConfigType = "json" // config's type
|
||||
ConfigDir = "config" // config's dir
|
||||
CasbinFileName = "rbac_model.conf" // casbin rule file's name
|
||||
)
|
||||
|
||||
// Status 0:unknown,1:true,2:false
|
||||
const (
|
||||
StatusUnknown int = iota
|
||||
StatusTrue
|
||||
StatusFalse
|
||||
)
|
||||
@@ -0,0 +1,26 @@
|
||||
package g
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestCons(t *testing.T) {
|
||||
t.Run("test constant param", func(t *testing.T) {
|
||||
if ConfigType != "json" {
|
||||
t.Errorf("ConfigType want %s but get %s", "json", ConfigType)
|
||||
}
|
||||
if ConfigDir != "config" {
|
||||
t.Errorf("ConfigDir want %s but get %s", "config", ConfigDir)
|
||||
}
|
||||
if CasbinFileName != "rbac_model.conf" {
|
||||
t.Errorf("CasbinFileName want %s but get %s", "rbac_model.conf", CasbinFileName)
|
||||
}
|
||||
if StatusUnknown != 0 {
|
||||
t.Errorf("StatusUnknown want %d but get %d", 0, StatusUnknown)
|
||||
}
|
||||
if StatusTrue != 1 {
|
||||
t.Errorf("StatusTrue want %d but get %d", 1, StatusTrue)
|
||||
}
|
||||
if StatusFalse != 2 {
|
||||
t.Errorf("StatusFalse want %d but get %d", 2, StatusFalse)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package g
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
TestRedisPwd = strings.TrimSpace(os.Getenv("redisProPwd"))
|
||||
TestMysqlAddr = strings.TrimSpace(os.Getenv("mysqlAddr"))
|
||||
TestMysqlPwd = strings.TrimSpace(os.Getenv("mysqlPwd"))
|
||||
TestMongoAddr = strings.TrimSpace(os.Getenv("mongoAddr"))
|
||||
TestDbType = strings.TrimSpace(os.Getenv("dbType"))
|
||||
)
|
||||
Reference in New Issue
Block a user