From eafd73c29204072050591a0579e0cedb174e6d38 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 13 Jan 2023 17:02:45 +0100 Subject: [chore] Remove omitempty on account source; refactor tests to use prettyprint json (#1337) * remove omitEmpty tag on account source items * update tests --- internal/federation/federatingactor_test.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'internal/federation/federatingactor_test.go') diff --git a/internal/federation/federatingactor_test.go b/internal/federation/federatingactor_test.go index 10ed60f68..0d1d8e37f 100644 --- a/internal/federation/federatingactor_test.go +++ b/internal/federation/federatingactor_test.go @@ -19,7 +19,9 @@ package federation_test import ( + "bytes" "context" + "encoding/json" "net/url" "testing" "time" @@ -130,7 +132,27 @@ func (suite *FederatingActorTestSuite) TestSendRemoteFollower() { suite.FailNow("timed out waiting for message") } - suite.Equal(`{"@context":"https://www.w3.org/ns/activitystreams","actor":"http://localhost:8080/users/the_mighty_zork","id":"http://localhost:8080/whatever_some_create","object":{"attributedTo":"http://localhost:8080/users/the_mighty_zork","content":"boobies","id":"http://localhost:8080/users/the_mighty_zork/statuses/01G1TR6BADACCZWQMNF9X21TV5","published":"2022-06-02T12:22:21+02:00","tag":[],"to":"http://localhost:8080/users/the_mighty_zork/followers","type":"Note","url":"http://localhost:8080/@the_mighty_zork/statuses/01G1TR6BADACCZWQMNF9X21TV5"},"published":"2022-06-02T12:22:21+02:00","to":"http://localhost:8080/users/the_mighty_zork/followers","type":"Create"}`, string(sent[0])) + dst := new(bytes.Buffer) + err = json.Indent(dst, sent[0], "", " ") + suite.NoError(err) + suite.Equal(`{ + "@context": "https://www.w3.org/ns/activitystreams", + "actor": "http://localhost:8080/users/the_mighty_zork", + "id": "http://localhost:8080/whatever_some_create", + "object": { + "attributedTo": "http://localhost:8080/users/the_mighty_zork", + "content": "boobies", + "id": "http://localhost:8080/users/the_mighty_zork/statuses/01G1TR6BADACCZWQMNF9X21TV5", + "published": "2022-06-02T12:22:21+02:00", + "tag": [], + "to": "http://localhost:8080/users/the_mighty_zork/followers", + "type": "Note", + "url": "http://localhost:8080/@the_mighty_zork/statuses/01G1TR6BADACCZWQMNF9X21TV5" + }, + "published": "2022-06-02T12:22:21+02:00", + "to": "http://localhost:8080/users/the_mighty_zork/followers", + "type": "Create" +}`, dst.String()) } func TestFederatingActorTestSuite(t *testing.T) { -- cgit v1.2.3