This commit is contained in:
@@ -120,6 +120,31 @@ func TestPublicationRelationshipsAndHistory(t *testing.T) {
|
||||
mutate(t, db, cms.ErrConflict, func(tx *sql.Tx) error { return PutRevision(ctx, tx, "merchant", news, 1, cms.Associations{}) })
|
||||
mutate(t, db, cms.ErrNotFound, func(tx *sql.Tx) error { return SetPublished(ctx, tx, "merchant", news, 999) })
|
||||
}
|
||||
|
||||
func TestPublishWithoutTaxonomyOrRelationships(t *testing.T) {
|
||||
db, reader := fixture(t)
|
||||
ctx := context.Background()
|
||||
ref := cms.Reference{Kind: "project", ID: "unclassified"}
|
||||
save(t, db, ref, 1, cms.Associations{}, true)
|
||||
value, err := reader.Revision(ctx, ref, 1)
|
||||
if err != nil || len(value.Terms) != 0 || len(value.Links) != 0 {
|
||||
t.Fatalf("empty associations: %+v %v", value, err)
|
||||
}
|
||||
page, err := reader.Related(ctx, ref, nil, 10)
|
||||
if err != nil || len(page.Items) != 0 {
|
||||
t.Fatalf("unexpected related content: %+v %v", page, err)
|
||||
}
|
||||
save(t, db, ref, 2, cms.Associations{Terms: []string{"go"}}, true)
|
||||
save(t, db, ref, 3, cms.Associations{}, true)
|
||||
old, err := reader.Revision(ctx, ref, 2)
|
||||
if err != nil || len(old.Terms) != 1 || old.Terms[0] != "go" {
|
||||
t.Fatal("clearing optional classification rewrote history", err)
|
||||
}
|
||||
page, err = reader.Members(ctx, "go", nil, 10)
|
||||
if err != nil || len(page.Items) != 0 {
|
||||
t.Fatalf("cleared classification still published: %+v %v", page, err)
|
||||
}
|
||||
}
|
||||
func TestTermRenameRetirementAndScope(t *testing.T) {
|
||||
db, r := fixture(t)
|
||||
ctx := context.Background()
|
||||
|
||||
Reference in New Issue
Block a user