feat: initial commit of vps-commander release v1.0.0

This commit is contained in:
kory
2026-09-28 07:48:01 +08:00
commit 467e28a6a1
48 changed files with 3851 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
package web
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
)
type testRunner struct{}
func (testRunner) DevicesJSON(w http.ResponseWriter, r *http.Request) {}
func (testRunner) AuditsJSON(w http.ResponseWriter, r *http.Request) {}
func (testRunner) PanelExec(w http.ResponseWriter, r *http.Request) {}
func (testRunner) RotateAPIKey(w http.ResponseWriter, r *http.Request) {}
func TestStaticCSSContentType(t *testing.T) {
p := New("test-password", testRunner{})
req := httptest.NewRequest("GET", "/static/app.css", nil)
rec := httptest.NewRecorder()
p.static(rec, req)
if rec.Code != 200 {
t.Fatalf("status=%d, want 200", rec.Code)
}
if got := rec.Header().Get("Content-Type"); got != "text/css; charset=utf-8" {
t.Fatalf("content-type=%q, want text/css; charset=utf-8", got)
}
if strings.TrimSpace(rec.Body.String()) == "" {
t.Fatal("CSS body is empty")
}
}