MCPcopy Index your code
hub / github.com/apache/casbin / TestLoadModelFromConfig

Function TestLoadModelFromConfig

model/model_test.go:77–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

75}
76
77func TestLoadModelFromConfig(t *testing.T) {
78 m := NewModel()
79 err := m.loadModelFromConfig(basicConfig)
80 if err != nil {
81 t.Error("basic config should not return an error")
82 }
83 m = NewModel()
84 err = m.loadModelFromConfig(&MockConfig{})
85 if err == nil {
86 t.Error("empty config should return error")
87 } else {
88 // check for missing sections in message
89 for _, rs := range requiredSections {
90 if !strings.Contains(err.Error(), sectionNameMap[rs]) {
91 t.Errorf("section name: %s should be in message", sectionNameMap[rs])
92 }
93 }
94 }
95}
96
97func TestHasSection(t *testing.T) {
98 m := NewModel()

Callers

nothing calls this directly

Calls 3

loadModelFromConfigMethod · 0.95
NewModelFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…