Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming. Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
29 lines
667 B
Go
29 lines
667 B
Go
package server
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"pageswiki/internal/store"
|
|
)
|
|
|
|
func TestManagedCampusOnlineUsesRecentAuthenticatedContact(t *testing.T) {
|
|
now := time.Unix(1000, 0)
|
|
campus := store.Campus{
|
|
AuthorityMode: "managed",
|
|
LastContactAt: now.Unix() - 5,
|
|
}
|
|
if !managedCampusOnline(campus, now) {
|
|
t.Fatal("recent authenticated contact was shown offline")
|
|
}
|
|
campus.LastContactError = "controller unavailable"
|
|
if managedCampusOnline(campus, now) {
|
|
t.Fatal("failed contact was shown online")
|
|
}
|
|
campus.LastContactError = ""
|
|
campus.LastContactAt = now.Unix() - 16
|
|
if managedCampusOnline(campus, now) {
|
|
t.Fatal("stale contact was shown online")
|
|
}
|
|
}
|