feat: import IMVU products into a catalog
The importer from t5de-hub's docs/imports.md: says hello to the hub with its key pair, follows the console's config (paused, rate, jobs at a time, IMVU accounts, whose sealed passwords it keeps), claims jobs, finds each product's newest revision on IMVU's CDN, converts it (originals for placeholders, no _contents.json, ProductRating from IMVU's rating), checks it by t5de-api's pack rules and uploads it to the catalog with an import token. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
2b0d27831e
commit
e8578e4a71
26 files changed
+2345
-1
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package catalog
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUploadRefused(t *testing.T) {
|
||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Header.Get("Authorization") != "Bearer tok" {
|
||||
t.Errorf("authorization %q", r.Header.Get("Authorization"))
|
||||
}
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
w.Write([]byte(`{"error":"bad_files","message":"These product files can't be used: index.xml: no ProductRating"}`))
|
||||
}))
|
||||
defer s.Close()
|
||||
_, err := Upload(context.Background(), nil, "test", s.URL, "tok", []byte("zip"))
|
||||
var e *Error
|
||||
if !errors.As(err, &e) || e.Status != 400 || e.Code != "bad_files" {
|
||||
t.Fatalf("got %v", err)
|
||||
}
|
||||
if e.Error() != "the catalog refused the upload (400 bad_files): These product files can't be used: index.xml: no ProductRating" {
|
||||
t.Errorf("message %q", e.Error())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user