mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
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
This commit is contained in:
@ -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()
|
||||
|
Reference in New Issue
Block a user