[bugfix] Delete mutual follow (requests) when receiving block from remote (#1960)

* [bugfix] Delete mutual follow (requests) on block

* fix test
This commit is contained in:
tobi 2023-07-08 16:43:12 +02:00 committed by GitHub
commit f40bb02f31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 112 additions and 24 deletions

View file

@ -734,7 +734,7 @@ func (suite *RelationshipTestSuite) TestRejectFollowRequestNotExisting() {
targetAccount := suite.testAccounts["local_account_2"]
err := suite.db.RejectFollowRequest(ctx, account.ID, targetAccount.ID)
suite.ErrorIs(err, db.ErrNoEntries)
suite.NoError(err)
}
func (suite *RelationshipTestSuite) TestGetAccountFollowRequests() {
@ -836,6 +836,19 @@ func (suite *RelationshipTestSuite) TestGetFollowNotExisting() {
suite.Nil(follow)
}
func (suite *RelationshipTestSuite) TestDeleteFollow() {
ctx := context.Background()
originAccount := suite.testAccounts["local_account_1"]
targetAccount := suite.testAccounts["admin_account"]
err := suite.db.DeleteFollow(ctx, originAccount.ID, targetAccount.ID)
suite.NoError(err)
follow, err := suite.db.GetFollow(ctx, originAccount.ID, targetAccount.ID)
suite.EqualError(err, db.ErrNoEntries.Error())
suite.Nil(follow)
}
func (suite *RelationshipTestSuite) TestUnfollowRequestExisting() {
ctx := context.Background()
originAccount := suite.testAccounts["admin_account"]