This commit is contained in:
@@ -126,3 +126,39 @@ func TestEditorialResponsibilityRequiresName(t *testing.T) {
|
||||
t.Fatalf("expected editorial responsibility name validation error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLegalContextPublicInterestRequiresAIText(t *testing.T) {
|
||||
_, err := NewFromQuery(url.Values{
|
||||
"mode": {"article"}, "lang": {"de"}, "textExtent": {"none"},
|
||||
"legalContext": {"publicInterestText"},
|
||||
}, "https://example.org/context/v1")
|
||||
if err == nil || !strings.Contains(err.Error(), "publicInterestText requires a text component with AI involvement") {
|
||||
t.Fatalf("expected public-interest consistency error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLegalContextDeepfakeRequiresAIMedia(t *testing.T) {
|
||||
_, err := NewFromQuery(url.Values{
|
||||
"mode": {"article"}, "lang": {"de"}, "textExtent": {"full"},
|
||||
"legalContext": {"deepfake"},
|
||||
}, "https://example.org/context/v1")
|
||||
if err == nil || !strings.Contains(err.Error(), "deepfake requires an image, audio or video component with AI involvement") {
|
||||
t.Fatalf("expected deepfake consistency error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLegalContextAndResponsibilityAreSerialized(t *testing.T) {
|
||||
d, err := NewFromQuery(url.Values{
|
||||
"mode": {"article"}, "lang": {"de"}, "textExtent": {"partial"}, "textReview": {"expert"},
|
||||
"legalContext": {"publicInterestText"}, "responsibleRole": {"publisher"}, "responsible": {"Beispielredaktion"},
|
||||
}, "https://example.org/context/v1")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if d.SchemaVersion != "1.2" || d.LegalContext == nil || len(d.LegalContext.Categories) != 1 {
|
||||
t.Fatalf("unexpected legal context: %#v", d)
|
||||
}
|
||||
if d.EditorialResponsibility == nil || !d.EditorialResponsibility.Assumed || d.EditorialResponsibility.Role != "publisher" {
|
||||
t.Fatalf("responsibility not explicitly assumed: %#v", d.EditorialResponsibility)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user