summaryrefslogtreecommitdiff
path: root/internal/typeutils/internaltoas_test.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-11-28 15:37:37 +0000
committerLibravatar GitHub <noreply@github.com>2024-11-28 15:37:37 +0000
commitd9f67efae512673c826b27daeae404a6051d9817 (patch)
treefe89c62e3f43eb285d6ed64b2b407986fe1917bb /internal/typeutils/internaltoas_test.go
parentpulls in the latest exif-terminator version with bugfix and performance optim... (diff)
downloadgotosocial-d9f67efae512673c826b27daeae404a6051d9817.tar.xz
send out poll votes as separate create activities given that no other AP servers support multiple objects in a single activity (#3582)
Diffstat (limited to 'internal/typeutils/internaltoas_test.go')
-rw-r--r--internal/typeutils/internaltoas_test.go64
1 files changed, 38 insertions, 26 deletions
diff --git a/internal/typeutils/internaltoas_test.go b/internal/typeutils/internaltoas_test.go
index a97eee2b8..c847cfc93 100644
--- a/internal/typeutils/internaltoas_test.go
+++ b/internal/typeutils/internaltoas_test.go
@@ -1104,43 +1104,55 @@ func (suite *InternalToASTestSuite) TestPinnedStatusesToASOneItem() {
func (suite *InternalToASTestSuite) TestPollVoteToASCreate() {
vote := suite.testPollVotes["remote_account_1_status_2_poll_vote_local_account_1"]
- create, err := suite.typeconverter.PollVoteToASCreate(context.Background(), vote)
- if err != nil {
- suite.FailNow(err.Error())
- }
+ creates, err := suite.typeconverter.PollVoteToASCreates(context.Background(), vote)
+ suite.NoError(err)
+ suite.Len(creates, 2)
+
+ createI0, err := ap.Serialize(creates[0])
+ suite.NoError(err)
- createI, err := ap.Serialize(create)
+ createI1, err := ap.Serialize(creates[1])
suite.NoError(err)
- bytes, err := json.MarshalIndent(createI, "", " ")
+ bytes0, err := json.MarshalIndent(createI0, "", " ")
+ suite.NoError(err)
+
+ bytes1, err := json.MarshalIndent(createI1, "", " ")
suite.NoError(err)
suite.Equal(`{
"@context": "https://www.w3.org/ns/activitystreams",
"actor": "http://localhost:8080/users/the_mighty_zork",
- "id": "http://localhost:8080/users/the_mighty_zork/activity#vote/http://fossbros-anonymous.io/users/foss_satan/statuses/01HEN2QRFA8H3C6QPN7RD4KSR6",
- "object": [
- {
- "attributedTo": "http://localhost:8080/users/the_mighty_zork",
- "id": "http://localhost:8080/users/the_mighty_zork#01HEN2R65468ZG657C4ZPHJ4EX/votes/1",
- "inReplyTo": "http://fossbros-anonymous.io/users/foss_satan/statuses/01HEN2QRFA8H3C6QPN7RD4KSR6",
- "name": "tissues",
- "to": "http://fossbros-anonymous.io/users/foss_satan",
- "type": "Note"
- },
- {
- "attributedTo": "http://localhost:8080/users/the_mighty_zork",
- "id": "http://localhost:8080/users/the_mighty_zork#01HEN2R65468ZG657C4ZPHJ4EX/votes/2",
- "inReplyTo": "http://fossbros-anonymous.io/users/foss_satan/statuses/01HEN2QRFA8H3C6QPN7RD4KSR6",
- "name": "financial times",
- "to": "http://fossbros-anonymous.io/users/foss_satan",
- "type": "Note"
- }
- ],
+ "id": "http://localhost:8080/users/the_mighty_zork/activity#vote0/http://fossbros-anonymous.io/users/foss_satan/statuses/01HEN2QRFA8H3C6QPN7RD4KSR6",
+ "object": {
+ "attributedTo": "http://localhost:8080/users/the_mighty_zork",
+ "id": "http://localhost:8080/users/the_mighty_zork#01HEN2R65468ZG657C4ZPHJ4EX/votes/1",
+ "inReplyTo": "http://fossbros-anonymous.io/users/foss_satan/statuses/01HEN2QRFA8H3C6QPN7RD4KSR6",
+ "name": "tissues",
+ "to": "http://fossbros-anonymous.io/users/foss_satan",
+ "type": "Note"
+ },
"published": "2021-09-11T11:45:37+02:00",
"to": "http://fossbros-anonymous.io/users/foss_satan",
"type": "Create"
-}`, string(bytes))
+}`, string(bytes0))
+
+ suite.Equal(`{
+ "@context": "https://www.w3.org/ns/activitystreams",
+ "actor": "http://localhost:8080/users/the_mighty_zork",
+ "id": "http://localhost:8080/users/the_mighty_zork/activity#vote1/http://fossbros-anonymous.io/users/foss_satan/statuses/01HEN2QRFA8H3C6QPN7RD4KSR6",
+ "object": {
+ "attributedTo": "http://localhost:8080/users/the_mighty_zork",
+ "id": "http://localhost:8080/users/the_mighty_zork#01HEN2R65468ZG657C4ZPHJ4EX/votes/2",
+ "inReplyTo": "http://fossbros-anonymous.io/users/foss_satan/statuses/01HEN2QRFA8H3C6QPN7RD4KSR6",
+ "name": "financial times",
+ "to": "http://fossbros-anonymous.io/users/foss_satan",
+ "type": "Note"
+ },
+ "published": "2021-09-11T11:45:37+02:00",
+ "to": "http://fossbros-anonymous.io/users/foss_satan",
+ "type": "Create"
+}`, string(bytes1))
}
func (suite *InternalToASTestSuite) TestInteractionReqToASAcceptAnnounce() {