summaryrefslogtreecommitdiff
path: root/internal/typeutils/astointernal_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-09-23 21:27:35 +0200
committerLibravatar GitHub <noreply@github.com>2022-09-23 20:27:35 +0100
commit69a193dae543641a2db6823fa6493c02f56fafbd (patch)
treec1a0c71d64642db12a17c6770642c3e0af859960 /internal/typeutils/astointernal_test.go
parent[docs] NLnet follow up questions (#846) (diff)
downloadgotosocial-69a193dae543641a2db6823fa6493c02f56fafbd.tar.xz
[feature] Allow delivery to sharedInboxes where possible (#847)
* update Activity * add instance-deliver-to-shared-inboxes setting * update activity version again * add SharedInboxURI field to accounts * serdes for endpoints/sharedInbox * deliver to sharedInbox if one is available * update tests * only assign shared inbox if shared domain * look for shared inbox if currently nil * go fmt * finger to get params.RemoteAccountID if necessary * make comments clearer * compare dns more consistently
Diffstat (limited to 'internal/typeutils/astointernal_test.go')
-rw-r--r--internal/typeutils/astointernal_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/typeutils/astointernal_test.go b/internal/typeutils/astointernal_test.go
index 7024018d6..9273405e6 100644
--- a/internal/typeutils/astointernal_test.go
+++ b/internal/typeutils/astointernal_test.go
@@ -45,6 +45,7 @@ func (suite *ASToInternalTestSuite) TestParsePerson() {
suite.Equal("https://unknown-instance.com/users/brand_new_person/following", acct.FollowingURI)
suite.Equal("https://unknown-instance.com/users/brand_new_person/followers", acct.FollowersURI)
suite.Equal("https://unknown-instance.com/users/brand_new_person/inbox", acct.InboxURI)
+ suite.Nil(acct.SharedInboxURI)
suite.Equal("https://unknown-instance.com/users/brand_new_person/outbox", acct.OutboxURI)
suite.Equal("https://unknown-instance.com/users/brand_new_person/collections/featured", acct.FeaturedCollectionURI)
suite.Equal("brand_new_person", acct.Username)
@@ -56,6 +57,28 @@ func (suite *ASToInternalTestSuite) TestParsePerson() {
suite.False(*acct.Locked)
}
+func (suite *ASToInternalTestSuite) TestParsePersonWithSharedInbox() {
+ testPerson := suite.testPeople["https://turnip.farm/users/turniplover6969"]
+
+ acct, err := suite.typeconverter.ASRepresentationToAccount(context.Background(), testPerson, "", false)
+ suite.NoError(err)
+
+ suite.Equal("https://turnip.farm/users/turniplover6969", acct.URI)
+ suite.Equal("https://turnip.farm/users/turniplover6969/following", acct.FollowingURI)
+ suite.Equal("https://turnip.farm/users/turniplover6969/followers", acct.FollowersURI)
+ suite.Equal("https://turnip.farm/users/turniplover6969/inbox", acct.InboxURI)
+ suite.Equal("https://turnip.farm/sharedInbox", *acct.SharedInboxURI)
+ suite.Equal("https://turnip.farm/users/turniplover6969/outbox", acct.OutboxURI)
+ suite.Equal("https://turnip.farm/users/turniplover6969/collections/featured", acct.FeaturedCollectionURI)
+ suite.Equal("turniplover6969", acct.Username)
+ suite.Equal("Turnip Lover 6969", acct.DisplayName)
+ suite.Equal("I just think they're neat", acct.Note)
+ suite.Equal("https://turnip.farm/@turniplover6969", acct.URL)
+ suite.True(*acct.Discoverable)
+ suite.Equal("https://turnip.farm/users/turniplover6969#main-key", acct.PublicKeyURI)
+ suite.False(*acct.Locked)
+}
+
func (suite *ASToInternalTestSuite) TestParsePublicStatus() {
m := make(map[string]interface{})
err := json.Unmarshal([]byte(publicStatusActivityJson), &m)
@@ -109,6 +132,8 @@ func (suite *ASToInternalTestSuite) TestParseGargron() {
acct, err := suite.typeconverter.ASRepresentationToAccount(context.Background(), rep, "", false)
suite.NoError(err)
+ suite.Equal("https://mastodon.social/inbox", *acct.SharedInboxURI)
+
fmt.Printf("%+v", acct)
// TODO: write assertions here, rn we're just eyeballing the output
}