summaryrefslogtreecommitdiff
path: root/internal/processing/processor_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/processing/processor_test.go')
-rw-r--r--internal/processing/processor_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/processing/processor_test.go b/internal/processing/processor_test.go
index 1c4dfb32f..7a1db442e 100644
--- a/internal/processing/processor_test.go
+++ b/internal/processing/processor_test.go
@@ -69,6 +69,7 @@ type ProcessingStandardTestSuite struct {
testMentions map[string]*gtsmodel.Mention
testAutheds map[string]*oauth.Auth
testBlocks map[string]*gtsmodel.Block
+ testActivities map[string]testrig.ActivityWithSignature
sentHTTPRequests map[string][]byte
@@ -92,6 +93,7 @@ func (suite *ProcessingStandardTestSuite) SetupSuite() {
Account: suite.testAccounts["local_account_1"],
},
}
+ suite.testActivities = testrig.NewTestActivities(suite.testAccounts)
suite.testBlocks = testrig.NewTestBlocks()
}
@@ -149,6 +151,32 @@ func (suite *ProcessingStandardTestSuite) SetupTest() {
return response, nil
}
+ if req.URL.String() == "http://example.org/users/some_user/statuses/afaba698-5740-4e32-a702-af61aa543bc1" {
+ // the request is for the forwarded message
+ message := suite.testActivities["forwarded_message"].Activity.GetActivityStreamsObject().At(0).GetActivityStreamsNote()
+ messageI, err := streams.Serialize(message)
+ if err != nil {
+ panic(err)
+ }
+ messageJson, err := json.Marshal(messageI)
+ if err != nil {
+ panic(err)
+ }
+ responseType := "application/activity+json"
+
+ reader := bytes.NewReader(messageJson)
+ readCloser := io.NopCloser(reader)
+ response := &http.Response{
+ StatusCode: 200,
+ Body: readCloser,
+ ContentLength: int64(len(messageJson)),
+ Header: http.Header{
+ "content-type": {responseType},
+ },
+ }
+ return response, nil
+ }
+
r := ioutil.NopCloser(bytes.NewReader([]byte{}))
return &http.Response{
StatusCode: 200,