mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-21 16:27:31 -06:00
[chore] Add test for dereferencing Owncast service account (#613)
This commit is contained in:
parent
1cdc163276
commit
dc8cc7e364
5 changed files with 344 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ type DereferencerStandardTestSuite struct {
|
|||
testRemoteStatuses map[string]vocab.ActivityStreamsNote
|
||||
testRemotePeople map[string]vocab.ActivityStreamsPerson
|
||||
testRemoteGroups map[string]vocab.ActivityStreamsGroup
|
||||
testRemoteServices map[string]vocab.ActivityStreamsService
|
||||
testRemoteAttachments map[string]testrig.RemoteAttachmentFile
|
||||
testAccounts map[string]*gtsmodel.Account
|
||||
|
||||
|
|
@ -60,6 +61,7 @@ func (suite *DereferencerStandardTestSuite) SetupTest() {
|
|||
suite.testRemoteStatuses = testrig.NewTestFediStatuses()
|
||||
suite.testRemotePeople = testrig.NewTestFediPeople()
|
||||
suite.testRemoteGroups = testrig.NewTestFediGroups()
|
||||
suite.testRemoteServices = testrig.NewTestFediServices()
|
||||
suite.testRemoteAttachments = testrig.NewTestFediAttachments("../../../testrig/media")
|
||||
|
||||
suite.db = testrig.NewTestDB()
|
||||
|
|
@ -126,6 +128,19 @@ func (suite *DereferencerStandardTestSuite) mockTransportController() transport.
|
|||
responseType = "application/activity+json"
|
||||
}
|
||||
|
||||
if service, ok := suite.testRemoteServices[req.URL.String()]; ok {
|
||||
serviceI, err := streams.Serialize(service)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
serviceJson, err := json.Marshal(serviceI)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
responseBytes = serviceJson
|
||||
responseType = "application/activity+json"
|
||||
}
|
||||
|
||||
if attachment, ok := suite.testRemoteAttachments[req.URL.String()]; ok {
|
||||
responseBytes = attachment.Data
|
||||
responseType = attachment.ContentType
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue