summaryrefslogtreecommitdiff
path: root/testrig/transportcontroller.go
diff options
context:
space:
mode:
Diffstat (limited to 'testrig/transportcontroller.go')
-rw-r--r--testrig/transportcontroller.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/testrig/transportcontroller.go b/testrig/transportcontroller.go
index 70f2f0c61..18c3094d5 100644
--- a/testrig/transportcontroller.go
+++ b/testrig/transportcontroller.go
@@ -33,6 +33,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/concurrency"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/federation"
+ "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/log"
"github.com/superseriousbusiness/gotosocial/internal/messages"
"github.com/superseriousbusiness/gotosocial/internal/transport"
@@ -65,6 +66,7 @@ type MockHTTPClient struct {
testRemoteServices map[string]vocab.ActivityStreamsService
testRemoteAttachments map[string]RemoteAttachmentFile
testRemoteEmojis map[string]vocab.TootEmoji
+ testTombstones map[string]*gtsmodel.Tombstone
SentMessages sync.Map
}
@@ -92,6 +94,7 @@ func NewMockHTTPClient(do func(req *http.Request) (*http.Response, error), relat
mockHTTPClient.testRemoteServices = NewTestFediServices()
mockHTTPClient.testRemoteAttachments = NewTestFediAttachments(relativeMediaPath)
mockHTTPClient.testRemoteEmojis = NewTestFediEmojis()
+ mockHTTPClient.testTombstones = NewTestTombstones()
mockHTTPClient.do = func(req *http.Request) (*http.Response, error) {
responseCode := http.StatusNotFound
@@ -193,6 +196,11 @@ func NewMockHTTPClient(do func(req *http.Request) (*http.Response, error), relat
responseBytes = attachment.Data
responseContentType = attachment.ContentType
responseContentLength = len(attachment.Data)
+ } else if _, ok := mockHTTPClient.testTombstones[req.URL.String()]; ok {
+ responseCode = http.StatusGone
+ responseBytes = []byte{}
+ responseContentType = "text/html"
+ responseContentLength = 0
}
log.Debugf("returning response %s", string(responseBytes))