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

Function TestEnforcerSetDetector

enforcer_test.go:772–785  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

770}
771
772func TestEnforcerSetDetector(t *testing.T) {
773 // Test SetDetector() method
774 e, _ := NewEnforcer("examples/rbac_model.conf", "examples/rbac_policy.csv")
775
776 // Create a custom detector
777 customDetector := detector.NewDefaultDetector()
778 e.SetDetector(customDetector)
779
780 // Should still work with custom detector
781 err := e.RunDetections()
782 if err != nil {
783 t.Errorf("Expected no error with custom detector, but got: %v", err)
784 }
785}
786
787func TestEnforcerSetDetectors(t *testing.T) {
788 // Test SetDetectors() method

Callers

nothing calls this directly

Calls 4

SetDetectorMethod · 0.95
RunDetectionsMethod · 0.95
NewDefaultDetectorFunction · 0.92
NewEnforcerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…