diff options
Diffstat (limited to 'internal/processing/processor_test.go')
-rw-r--r-- | internal/processing/processor_test.go | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/internal/processing/processor_test.go b/internal/processing/processor_test.go index f2a9e455e..beae5dba0 100644 --- a/internal/processing/processor_test.go +++ b/internal/processing/processor_test.go @@ -96,9 +96,9 @@ func (suite *ProcessingStandardTestSuite) SetupSuite() { } func (suite *ProcessingStandardTestSuite) SetupTest() { + testrig.InitTestLog() suite.config = testrig.NewTestConfig() suite.db = testrig.NewTestDB() - testrig.InitTestLog() suite.storage = testrig.NewTestStorage() suite.typeconverter = testrig.NewTestTypeConverter(suite.db) @@ -149,6 +149,38 @@ func (suite *ProcessingStandardTestSuite) SetupTest() { return response, nil } + if req.URL.String() == suite.testAccounts["remote_account_2"].URI { + // the request is for remote account 2 + someAccount := suite.testAccounts["remote_account_2"] + + someAccountAS, err := suite.typeconverter.AccountToAS(context.Background(), someAccount) + if err != nil { + panic(err) + } + + someAccountI, err := streams.Serialize(someAccountAS) + if err != nil { + panic(err) + } + someAccountJson, err := json.Marshal(someAccountI) + if err != nil { + panic(err) + } + responseType := "application/activity+json" + + reader := bytes.NewReader(someAccountJson) + readCloser := io.NopCloser(reader) + response := &http.Response{ + StatusCode: 200, + Body: readCloser, + ContentLength: int64(len(someAccountJson)), + Header: http.Header{ + "content-type": {responseType}, + }, + } + 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() |