Files
pages/internal/server/task_cli_test.go
T
Anya Tokugawa 3262f88005
Build and publish container images / images (push) Successful in 11m59s
Release container images / release (push) Successful in 25s
fix: use subject-independent identities for captured mail Wiki paths
2026-11-06 09:02:34 +09:00

34 lines
937 B
Go

package server
import (
"bytes"
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"os/exec"
"testing"
"time"
)
func TestTaskCLIHTTPIntegration(t *testing.T) {
if _, e := exec.LookPath("python3"); e != nil {
t.Skip("python3 not installed")
}
s, token, _, _ := taskFixture(t)
s.mux.HandleFunc("/v/raw/", s.handleRawView)
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.Host = "localhost"
s.withAuthorization(s.mux).ServeHTTP(w, r)
}))
defer server.Close()
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
cmd := exec.CommandContext(ctx, "python3", "pages-cli/test_task_integration.py")
b, _ := json.Marshal(map[string]string{"origin": server.URL, "token": token, "root": t.TempDir()})
cmd.Stdin = bytes.NewReader(b)
if out, e := cmd.CombinedOutput(); e != nil {
t.Fatalf("CLI task integration %v: %s", e, out)
}
}