Add PDF_ATTACHMENT stimulus kind and MinIO pdf upload (media_type=pdf) for question-side PDFs. Reject top-level question_text on DYNAMIC create/update; omit it from API responses and derive stored text from stimulus only. Expand DYNAMIC_QUESTION_TYPE_BUILDER_ADMIN_INTEGRATION.md with full API request/response reference and workflows. Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
676 B
Go
21 lines
676 B
Go
package handlers
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizeAndValidateMediaContentType_pdf(t *testing.T) {
|
|
got, err := normalizeAndValidateMediaContentType("pdf", "application/pdf", "reading-passage.pdf")
|
|
if err != nil || got != "application/pdf" {
|
|
t.Fatalf("expected application/pdf, got %q err=%v", got, err)
|
|
}
|
|
|
|
got, err = normalizeAndValidateMediaContentType("pdf", "application/octet-stream", "notes.pdf")
|
|
if err != nil || got != "application/pdf" {
|
|
t.Fatalf("expected pdf from extension, got %q err=%v", got, err)
|
|
}
|
|
|
|
_, err = normalizeAndValidateMediaContentType("pdf", "image/png", "file.png")
|
|
if err == nil {
|
|
t.Fatal("expected error for non-pdf content")
|
|
}
|
|
}
|