mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-31 05:36:14 -06:00
mock dereference of status from IRI
This commit is contained in:
parent
71962625bc
commit
ae04732ab7
1 changed files with 26 additions and 0 deletions
|
|
@ -149,6 +149,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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue