summaryrefslogtreecommitdiff
path: root/internal/federation/dereferencing/account_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/federation/dereferencing/account_test.go')
-rw-r--r--internal/federation/dereferencing/account_test.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/internal/federation/dereferencing/account_test.go b/internal/federation/dereferencing/account_test.go
index 518f3e89f..0cb23f18d 100644
--- a/internal/federation/dereferencing/account_test.go
+++ b/internal/federation/dereferencing/account_test.go
@@ -28,6 +28,7 @@ import (
"io"
"net/http"
"net/url"
+ "strings"
"testing"
"time"
@@ -473,6 +474,49 @@ func (suite *AccountTestSuite) TestRefreshFederatedRemoteAccountWithKeyChange()
suite.True(updatedAcc.PublicKey.Equal(fetchingAcc.PublicKey))
}
+func (suite *AccountTestSuite) TestDereferenceRemoteAccountWithAvatarDescription() {
+ ctx, cncl := context.WithCancel(suite.T().Context())
+ defer cncl()
+
+ fetchingAcc := suite.testAccounts["local_account_1"]
+ remoteURI := "https://shrimpnet.example.org/users/shrimp"
+ description := "me scrolling fedi on a laptop, there's a monster ultra white and another fedi user on my right."
+
+ // Fetch the remote account to load into the database.
+ remoteAcc, _, err := suite.dereferencer.GetAccountByURI(ctx,
+ fetchingAcc.Username,
+ testrig.URLMustParse(remoteURI),
+ false,
+ )
+ suite.NoError(err)
+ suite.NotNil(remoteAcc)
+
+ suite.Equal(remoteAcc.AvatarMediaAttachment.Description, description)
+
+ remotePerson := suite.client.TestRemotePeople[remoteURI]
+
+ description = strings.TrimSuffix(description, ".")
+
+ icon := remotePerson.GetActivityStreamsIcon()
+ image := icon.Begin().GetActivityStreamsImage()
+ nameProp := streams.NewActivityStreamsNameProperty()
+ nameProp.AppendXMLSchemaString(description)
+ image.SetActivityStreamsName(nameProp)
+ icon.SetActivityStreamsImage(0, image)
+ remotePerson.SetActivityStreamsIcon(icon)
+
+ updatedAcc, apAcc, err := suite.dereferencer.RefreshAccount(ctx,
+ fetchingAcc.Username,
+ remoteAcc,
+ remotePerson,
+ nil,
+ )
+
+ suite.NoError(err)
+ suite.NotNil(apAcc)
+ suite.Equal(updatedAcc.AvatarMediaAttachment.Description, description)
+}
+
func TestAccountTestSuite(t *testing.T) {
suite.Run(t, new(AccountTestSuite))
}