summaryrefslogtreecommitdiff
path: root/internal/processing/processor_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-10-16 13:27:43 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-16 13:27:43 +0200
commit15621f5324b4613d83efb94711c97eeaa83da2b3 (patch)
treeb86c837dec89f5c74a7127f1bcd8e224bf6dd8a6 /internal/processing/processor_test.go
parentUser password change (#280) (diff)
downloadgotosocial-15621f5324b4613d83efb94711c97eeaa83da2b3.tar.xz
Follow request improvements (#282)
* tiny doc update * add rejectfollowrequest to db * add follow request reject to processor * add reject handler * tidy up follow request api * tidy up federation call * regenerate swagger docs * api endpoint tests * processor test * add reject federatingdb handler * start writing reject tests * test reject follow request * go fmt * increase sleep for slow test setups * more relaxed time.sleep
Diffstat (limited to 'internal/processing/processor_test.go')
-rw-r--r--internal/processing/processor_test.go34
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()