diff options
Diffstat (limited to 'testrig/testmodels.go')
-rw-r--r-- | testrig/testmodels.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testrig/testmodels.go b/testrig/testmodels.go index a38e72329..e4daed12c 100644 --- a/testrig/testmodels.go +++ b/testrig/testmodels.go @@ -27,10 +27,12 @@ import ( "crypto/x509" "encoding/json" "encoding/pem" + "fmt" "io/ioutil" "net" "net/http" "net/url" + "os" "time" "github.com/go-fed/activity/pub" @@ -1285,6 +1287,25 @@ func NewTestFediPeople() map[string]vocab.ActivityStreamsPerson { } } +// RemoteAttachmentFile mimics a remote (federated) attachment +type RemoteAttachmentFile struct { + Data []byte + ContentType string +} + +func NewTestFediAttachments(relativePath string) map[string]RemoteAttachmentFile { + beeBytes, err := os.ReadFile(fmt.Sprintf("%s/beeplushie.jpg", relativePath)) + if err != nil { + panic(err) + } + return map[string]RemoteAttachmentFile{ + "https://s3-us-west-2.amazonaws.com/plushcity/media_attachments/files/106/867/380/219/163/828/original/88e8758c5f011439.jpg": { + Data: beeBytes, + ContentType: "image/jpeg", + }, + } +} + func NewTestFediStatuses() map[string]vocab.ActivityStreamsNote { return map[string]vocab.ActivityStreamsNote{ "https://unknown-instance.com/users/brand_new_person/statuses/01FE4NTHKWW7THT67EF10EB839": newNote( |