Shown only where GroupVerify is: staff get the Verification page once its gv_* tables are in the database, and the public site shows "Verified" only while it's on (enabled, with a group) and not missing from css_plugins list, which the poller reads once a minute over RCON. - Verification page: plugin state and version, Steam group, saved member list, overrides. - Overrides (@zio/verify, not on yourself unless Root): give, change, remove; player drawer shows why a player is or isn't verified. - Root sets the group and turns it on/off: saved to gv_settings, and sent as css_gv_* when the plugin is loaded so it applies at once. - gv_* times use GroupVerify's own timezone setting. - MySQL integration test (SAW_TEST_DSN), unit tests for plugin list parsing and the show rule.
43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
package web
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.zio.sh/cs2/simpleadmin-web/internal/live"
|
|
"git.zio.sh/cs2/simpleadmin-web/internal/store"
|
|
)
|
|
|
|
func TestIsClanID(t *testing.T) {
|
|
for _, c := range []struct {
|
|
id uint64
|
|
want bool
|
|
}{
|
|
{103582791429521412, true}, // a group
|
|
{103582791429521408, false}, // account 0
|
|
{76561198012345678, false}, // a player
|
|
{0, false},
|
|
} {
|
|
if got := isClanID(c.id); got != c.want {
|
|
t.Errorf("isClanID(%d) = %v, want %v", c.id, got, c.want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestVerifyShown(t *testing.T) {
|
|
on := store.VerifySettings{Enabled: true, GroupID: "103582791429521412"}
|
|
for _, c := range []struct {
|
|
info verifyInfo
|
|
want bool
|
|
}{
|
|
{verifyInfo{Tables: true, Settings: on, Plugin: live.PluginLoaded}, true},
|
|
{verifyInfo{Tables: true, Settings: on, Plugin: live.PluginUnknown}, true},
|
|
{verifyInfo{Tables: true, Settings: on, Plugin: live.PluginMissing}, false},
|
|
{verifyInfo{Tables: false, Settings: on, Plugin: live.PluginLoaded}, false},
|
|
{verifyInfo{Tables: true, Settings: store.VerifySettings{Enabled: false, GroupID: on.GroupID}, Plugin: live.PluginLoaded}, false},
|
|
{verifyInfo{Tables: true, Settings: store.VerifySettings{Enabled: true}, Plugin: live.PluginLoaded}, false},
|
|
} {
|
|
if got := c.info.Shown(); got != c.want {
|
|
t.Errorf("%+v: Shown() = %v, want %v", c.info, got, c.want)
|
|
}
|
|
}
|
|
}
|