WitNote / internal /cli /actions /actions_system_test.go
AUXteam's picture
Upload folder using huggingface_hub
6a7089a verified
package actions
import (
"testing"
)
func TestHealth(t *testing.T) {
m := newMockServer()
m.response = `{"status":"ok","version":"dev"}`
defer m.close()
client := m.server.Client()
Health(client, m.base(), "")
if m.lastPath != "/health" {
t.Errorf("expected /health, got %s", m.lastPath)
}
}
func TestAuthHeader(t *testing.T) {
m := newMockServer()
defer m.close()
client := m.server.Client()
Health(client, m.base(), "my-secret-token")
auth := m.lastHeaders.Get("Authorization")
if auth != "Bearer my-secret-token" {
t.Errorf("expected 'Bearer my-secret-token', got %q", auth)
}
}
func TestNoAuthHeader(t *testing.T) {
m := newMockServer()
defer m.close()
client := m.server.Client()
Health(client, m.base(), "")
auth := m.lastHeaders.Get("Authorization")
if auth != "" {
t.Errorf("expected no auth header, got %q", auth)
}
}