Add container publishing and env-based runtime
CI / test (push) Successful in 30s
CI / publish (push) Failing after 27s

This commit is contained in:
Joe Julian
2026-03-28 15:36:52 -07:00
parent 36af73a209
commit 5f16410960
5 changed files with 103 additions and 53 deletions
+39
View File
@@ -1,6 +1,7 @@
package main
import (
"os"
"strings"
"testing"
"time"
@@ -93,6 +94,44 @@ func TestExtractLikeLiveMissingTable(t *testing.T) {
}
}
func TestLoadAlmaCredsFromEnv(t *testing.T) {
t.Setenv("ALMA_USERNAME", "student")
t.Setenv("ALMA_PASSWORD", "secret")
got, err := loadAlmaCreds("")
if err != nil {
t.Fatalf("loadAlmaCreds returned error: %v", err)
}
if got["username"] != "student" || got["password"] != "secret" {
t.Fatalf("unexpected creds: %#v", got)
}
}
func TestLoadAlmaCredsRequiresPasswordWithEnvUsername(t *testing.T) {
t.Setenv("ALMA_USERNAME", "student")
t.Setenv("ALMA_PASSWORD", "")
if _, err := loadAlmaCreds(""); err == nil {
t.Fatal("expected error when ALMA_PASSWORD is missing")
}
}
func TestLoadAlmaCredsFromFile(t *testing.T) {
dir := t.TempDir()
path := dir + "/alma.creds"
if err := os.WriteFile(path, []byte("username: student\npassword: secret\n"), 0o600); err != nil {
t.Fatalf("write creds file: %v", err)
}
got, err := loadAlmaCreds(path)
if err != nil {
t.Fatalf("loadAlmaCreds returned error: %v", err)
}
if got["username"] != "student" || got["password"] != "secret" {
t.Fatalf("unexpected creds: %#v", got)
}
}
func mustParseHTML(text string) *html.Node {
doc, err := html.Parse(strings.NewReader(text))
if err != nil {