test: cover unpublished content interactions
This commit is contained in:
@@ -265,6 +265,25 @@ func (s *ContentTestSuite) Test_Interact() {
|
||||
So(err, ShouldBeNil)
|
||||
So(len(favs), ShouldEqual, 0)
|
||||
})
|
||||
|
||||
Convey("should reject interactions for unpublished content", func() {
|
||||
other := &models.User{Username: "user_act2", Phone: "13900000099"}
|
||||
models.UserQuery.WithContext(ctx).Create(other)
|
||||
|
||||
draft := &models.Content{
|
||||
TenantID: 1,
|
||||
UserID: u.ID,
|
||||
Title: "Draft Content",
|
||||
Status: consts.ContentStatusDraft,
|
||||
}
|
||||
models.ContentQuery.WithContext(ctx).Create(draft)
|
||||
|
||||
err := Content.AddLike(ctx, tenantID, other.ID, draft.ID)
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
err = Content.AddFavorite(ctx, tenantID, other.ID, draft.ID)
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user