diff options
author | 2023-01-27 14:48:11 +0100 | |
---|---|---|
committer | 2023-01-27 14:48:11 +0100 | |
commit | 3283900b0d0b98e5ca956f61ce09ab373cf0cbe8 (patch) | |
tree | f7dc654ea2d510e0c02d63d8a174908f1e25c680 /internal/typeutils/internaltoas_test.go | |
parent | [docs] Add Flag documentation to federation docs (#1393) (diff) | |
download | gotosocial-3283900b0d0b98e5ca956f61ce09ab373cf0cbe8.tar.xz |
[feature] Federate reports to remote instance as Flag (if desired) (#1386)
* reports federate out, we did it lxds
* fix optional line start (should be optional slash)
Diffstat (limited to 'internal/typeutils/internaltoas_test.go')
-rw-r--r-- | internal/typeutils/internaltoas_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/typeutils/internaltoas_test.go b/internal/typeutils/internaltoas_test.go index d9a91b736..0bbb80dac 100644 --- a/internal/typeutils/internaltoas_test.go +++ b/internal/typeutils/internaltoas_test.go @@ -510,6 +510,40 @@ func (suite *InternalToASTestSuite) TestSelfBoostFollowersOnlyToAS() { }`, string(bytes)) } +func (suite *InternalToASTestSuite) TestReportToAS() { + ctx := context.Background() + + testReport := suite.testReports["local_account_2_report_remote_account_1"] + account := suite.testAccounts["local_account_2"] + targetAccount := suite.testAccounts["remote_account_1"] + statuses := []*gtsmodel.Status{suite.testStatuses["remote_account_1_status_1"]} + + testReport.Account = account + testReport.TargetAccount = targetAccount + testReport.Statuses = statuses + + flag, err := suite.typeconverter.ReportToASFlag(ctx, testReport) + suite.NoError(err) + + ser, err := streams.Serialize(flag) + suite.NoError(err) + + bytes, err := json.MarshalIndent(ser, "", " ") + suite.NoError(err) + + suite.Equal(`{ + "@context": "https://www.w3.org/ns/activitystreams", + "actor": "http://localhost:8080/users/localhost:8080", + "content": "dark souls sucks, please yeet this nerd", + "id": "http://localhost:8080/reports/01GP3AWY4CRDVRNZKW0TEAMB5R", + "object": [ + "http://fossbros-anonymous.io/users/foss_satan", + "http://fossbros-anonymous.io/users/foss_satan/statuses/01FVW7JHQFSFK166WWKR8CBA6M" + ], + "type": "Flag" +}`, string(bytes)) +} + func TestInternalToASTestSuite(t *testing.T) { suite.Run(t, new(InternalToASTestSuite)) } |