From 2b14b208025e5f7e57f71dcaba6d396081bdc54b Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sat, 4 Sep 2021 14:02:01 +0200 Subject: rework media processing a little bit (#191) * rework media processing a little bit * review changes --- testrig/testmodels.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'testrig/testmodels.go') 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( -- cgit v1.2.3