This commit is contained in:
@@ -113,3 +113,22 @@ func TestUpsertDelete(t *testing.T) {
|
||||
t.Fatalf("count=%d", s.Count())
|
||||
}
|
||||
}
|
||||
|
||||
func TestExternalKnowledgeIsReadOnly(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
data := t.TempDir()
|
||||
s, err := Load(context.Background(), dir, data, nil, false, []string{"internal-kb", "glpi-kb"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
d := model.KnowledgeDoc{ID: "GLPI-KB-1", Title: "Extern", Text: "Wissen", Source: "glpi-kb", Language: "de-DE", CommunicationStyle: "formal"}
|
||||
if err := s.ReplaceExternalSource(context.Background(), "glpi-kb", []model.KnowledgeDoc{d}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if s.Count() != 1 || s.Origin("GLPI-KB-1") != "glpi-kb" {
|
||||
t.Fatalf("unexpected external store state")
|
||||
}
|
||||
if err := s.Upsert(context.Background(), d); err == nil {
|
||||
t.Fatal("expected external document to be read-only")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user