Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts. Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation. Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package server
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"encoding/json"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"os/exec"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestRemoteCLIHTTPIntegration(t *testing.T) {
|
|
if _, err := exec.LookPath("python3"); err != nil {
|
|
t.Skip("python3 not installed")
|
|
}
|
|
s, _, _, _ := editorFixture(t)
|
|
s.mux.HandleFunc("/_/auth/", s.handleAuth)
|
|
s.mux.HandleFunc("/v/raw/", s.handleRawView)
|
|
s.mux.HandleFunc("/_/api/v1/path-picker", s.handlePathPickerAPI)
|
|
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_pages.py", "--integration")
|
|
input, _ := json.Marshal(map[string]string{"origin": server.URL})
|
|
cmd.Stdin = bytes.NewReader(input)
|
|
if out, err := cmd.CombinedOutput(); err != nil {
|
|
t.Fatalf("remote CLI: %v\n%s", err, out)
|
|
}
|
|
}
|