summaryrefslogtreecommitdiff
path: root/internal/federation/dereferencing/status_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/federation/dereferencing/status_test.go')
-rw-r--r--internal/federation/dereferencing/status_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/federation/dereferencing/status_test.go b/internal/federation/dereferencing/status_test.go
index e9cdbcff5..2d0085cce 100644
--- a/internal/federation/dereferencing/status_test.go
+++ b/internal/federation/dereferencing/status_test.go
@@ -19,6 +19,7 @@ package dereferencing_test
import (
"context"
+ "fmt"
"testing"
"github.com/stretchr/testify/suite"
@@ -218,6 +219,28 @@ func (suite *StatusTestSuite) TestDereferenceStatusWithImageAndNoContent() {
suite.NoError(err)
}
+func (suite *StatusTestSuite) TestDereferenceStatusWithNonMatchingURI() {
+ fetchingAccount := suite.testAccounts["local_account_1"]
+
+ const (
+ remoteURI = "https://turnip.farm/users/turniplover6969/statuses/70c53e54-3146-42d5-a630-83c8b6c7c042"
+ remoteAltURI = "https://turnip.farm/users/turniphater420/statuses/70c53e54-3146-42d5-a630-83c8b6c7c042"
+ )
+
+ // Create a copy of this remote account at alternative URI.
+ remoteStatus := suite.client.TestRemoteStatuses[remoteURI]
+ suite.client.TestRemoteStatuses[remoteAltURI] = remoteStatus
+
+ // Attempt to fetch account at alternative URI, it should fail!
+ fetchedStatus, _, err := suite.dereferencer.GetStatusByURI(
+ context.Background(),
+ fetchingAccount.Username,
+ testrig.URLMustParse(remoteAltURI),
+ )
+ suite.Equal(err.Error(), fmt.Sprintf("enrichStatus: dereferenced status uri %s does not match %s", remoteURI, remoteAltURI))
+ suite.Nil(fetchedStatus)
+}
+
func TestStatusTestSuite(t *testing.T) {
suite.Run(t, new(StatusTestSuite))
}