summaryrefslogtreecommitdiff
path: root/internal/db/bundb/relationship_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db/bundb/relationship_test.go')
-rw-r--r--internal/db/bundb/relationship_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/internal/db/bundb/relationship_test.go b/internal/db/bundb/relationship_test.go
index f1d1a35d2..46a4f1f25 100644
--- a/internal/db/bundb/relationship_test.go
+++ b/internal/db/bundb/relationship_test.go
@@ -510,6 +510,43 @@ func (suite *RelationshipTestSuite) TestDeleteAccountBlocks() {
suite.Nil(block)
}
+func (suite *RelationshipTestSuite) TestDeleteAccountMutes() {
+ ctx := context.Background()
+
+ // Add a mute.
+ accountID1 := suite.testAccounts["local_account_1"].ID
+ accountID2 := suite.testAccounts["local_account_2"].ID
+ muteID := "01HZGZ3F3C7S1TTPE8F9VPZDCB"
+ err := suite.db.PutMute(ctx, &gtsmodel.UserMute{
+ ID: muteID,
+ AccountID: accountID1,
+ TargetAccountID: accountID2,
+ })
+ if err != nil {
+ suite.FailNow(err.Error())
+ }
+
+ // Make sure the mute is in the DB.
+ mute, err := suite.db.GetMute(ctx, accountID1, accountID2)
+ if err != nil {
+ suite.FailNow(err.Error())
+ }
+ if suite.NotNil(mute) {
+ suite.Equal(muteID, mute.ID)
+ }
+
+ // Delete all mutes owned by that account.
+ err = suite.db.DeleteAccountMutes(ctx, accountID1)
+ if err != nil {
+ suite.FailNow(err.Error())
+ }
+
+ // Mute should be gone.
+ mute, err = suite.db.GetMute(ctx, accountID1, accountID2)
+ suite.ErrorIs(err, db.ErrNoEntries)
+ suite.Nil(mute)
+}
+
func (suite *RelationshipTestSuite) TestGetRelationship() {
requestingAccount := suite.testAccounts["local_account_1"]
targetAccount := suite.testAccounts["admin_account"]