From 24fbdf2b0a820684b69b10893e82cdb1a76ca14d Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 13 Jun 2023 16:47:56 +0200 Subject: [chore] Refactor AP authentication, other small bits of tidying up (#1874) --- internal/api/activitypub/users/inboxpost_test.go | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'internal/api/activitypub/users/inboxpost_test.go') diff --git a/internal/api/activitypub/users/inboxpost_test.go b/internal/api/activitypub/users/inboxpost_test.go index 82e86fb9c..c5027f342 100644 --- a/internal/api/activitypub/users/inboxpost_test.go +++ b/internal/api/activitypub/users/inboxpost_test.go @@ -517,6 +517,31 @@ func (suite *InboxPostTestSuite) TestPostFromBlockedAccount() { ) } +func (suite *InboxPostTestSuite) TestPostFromBlockedAccountToOtherAccount() { + var ( + requestingAccount = suite.testAccounts["remote_account_1"] + targetAccount = suite.testAccounts["local_account_1"] + activity = suite.testActivities["reply_to_turtle_for_turtle"] + statusURI = "http://fossbros-anonymous.io/users/foss_satan/statuses/2f1195a6-5cb0-4475-adf5-92ab9a0147fe" + ) + + // Post an reply to turtle to ZORK from remote account. + // Turtle blocks the remote account but is only tangentially + // related to this POST request. The response will indicate + // accepted but the post won't actually be processed. + suite.inboxPost( + activity.Activity, + requestingAccount, + targetAccount, + http.StatusAccepted, + `{"status":"Accepted"}`, + suite.signatureCheck, + ) + + _, err := suite.state.DB.GetStatusByURI(context.Background(), statusURI) + suite.ErrorIs(err, db.ErrNoEntries) +} + func (suite *InboxPostTestSuite) TestPostUnauthorized() { var ( requestingAccount = suite.testAccounts["remote_account_1"] -- cgit v1.2.3