rin
Публичный Open-source lightweight git hosting.
agents_test.go · 33 строки · 762 B
Raw
1 package handlers
2
3 import (
4 "net/http"
5 "strings"
6 "testing"
7 )
8
9 // TestAgentsPage checks that the public agent guide renders for anonymous visitors.
10 func TestAgentsPage(t *testing.T) {
11 app, _, _, _ := setupTestApp(t)
12
13 status, body := getPage(t, app, "/agents")
14 if status != http.StatusOK {
15 t.Fatalf("GET /agents status %d", status)
16 }
17 for _, want := range []string{
18 "Polar for AI agents",
19 "RFC 8628",
20 "/api/v1/device/code",
21 "/api/v1/device/token",
22 "polar_session",
23 "releases/new",
24 "git-credential-polar",
25 } {
26 if !strings.Contains(body, want) {
27 t.Errorf("/agents page body missing %q", want)
28 }
29 }
30 if !strings.Contains(body, "<title>AI agents · Polar</title>") {
31 t.Errorf("/agents page title should be \"AI agents · Polar\"")
32 }
33 }
34