19 lines
461 B
Go
19 lines
461 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.pcux.cn/xuans/Smail/utils/context"
|
|
)
|
|
|
|
func TestSettingsHtmlRejectsNonAdminSave(t *testing.T) {
|
|
s := &SpamBlock{}
|
|
result := s.SettingsHtml(&context.Context{}, "SpamBlock/save", `{"url":"https://model.example.com/predict"}`)
|
|
if result != "No Access Privileges" {
|
|
t.Fatalf("non-admin save result = %q, want access denial", result)
|
|
}
|
|
if s.cfg.ApiURL != "" {
|
|
t.Fatal("non-admin save changed the configuration")
|
|
}
|
|
}
|