feat(t222): add freight ingestion admin flow

This commit is contained in:
QiuSW
2026-07-28 23:26:34 +08:00
parent c524e734fb
commit 6d052b0462
37 changed files with 3397 additions and 101 deletions
+31
View File
@@ -6,6 +6,7 @@ import (
"net"
"net/http"
"net/http/httptest"
"net/url"
"path/filepath"
"testing"
"time"
@@ -158,6 +159,36 @@ func TestBuildRouterRegistersProtectedLogoutRoute(t *testing.T) {
response.Header().Get("Location"),
)
}
for _, target := range []string{"/freight", "/freight/import"} {
request = httptest.NewRequest(http.MethodGet, target, nil)
response = httptest.NewRecorder()
router.ServeHTTP(response, request)
if response.Code != http.StatusSeeOther ||
response.Header().Get("Location") !=
"/login?next="+url.QueryEscape(target) {
t.Fatalf(
"%s status/location = %d / %q",
target,
response.Code,
response.Header().Get("Location"),
)
}
}
request = httptest.NewRequest(
http.MethodGet,
"/api/v1/freight-orders",
nil,
)
response = httptest.NewRecorder()
router.ServeHTTP(response, request)
if response.Code != http.StatusUnauthorized ||
response.Header().Get("Cache-Control") != "no-store" {
t.Fatalf(
"freight API status/cache = %d / %q",
response.Code,
response.Header().Get("Cache-Control"),
)
}
}
type stubMigrationStatusReader struct {