summaryrefslogtreecommitdiff
path: root/testrig/testmodels.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-08-24 11:49:37 +0200
committerLibravatar GitHub <noreply@github.com>2024-08-24 11:49:37 +0200
commitf23f04e0b1d117be714bf91d5266dab219ed741e (patch)
tree0b3ddd60d51c8729949c3669993910a7f8f32a7b /testrig/testmodels.go
parent[performance] ffmpeg ffprobe wrapper improvements (#3225) (diff)
downloadgotosocial-f23f04e0b1d117be714bf91d5266dab219ed741e.tar.xz
[feature] Interaction requests client api + settings panel (#3215)
* [feature] Interaction requests client api + settings panel * test accept / reject * fmt * don't pin rejected interaction * use single db model for interaction accept, reject, and request * swaggor * env sharting * append errors * remove ErrNoEntries checks * change intReqID to reqID * rename "pend" to "request" * markIntsPending -> mark interactionsPending * use log instead of returning error when rejecting interaction * empty migration * jolly renaming * make interactionURI unique again * swag grr * remove unnecessary locks * invalidate as last step
Diffstat (limited to 'testrig/testmodels.go')
-rw-r--r--testrig/testmodels.go55
1 files changed, 55 insertions, 0 deletions
diff --git a/testrig/testmodels.go b/testrig/testmodels.go
index 3cf785908..943fb7396 100644
--- a/testrig/testmodels.go
+++ b/testrig/testmodels.go
@@ -1509,6 +1509,31 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
ActivityStreamsType: ap.ObjectNote,
PendingApproval: util.Ptr(false),
},
+ "admin_account_status_5": {
+ ID: "01J5QVB9VC76NPPRQ207GG4DRZ",
+ URI: "http://localhost:8080/users/admin/statuses/01J5QVB9VC76NPPRQ207GG4DRZ",
+ URL: "http://localhost:8080/@admin/statuses/01J5QVB9VC76NPPRQ207GG4DRZ",
+ Content: `<p>Hi <span class="h-card"><a href="http://localhost:8080/@1happyturtle" class="u-url mention" rel="nofollow noreferrer noopener" target="_blank">@<span>1happyturtle</span></a></span>, can I reply?</p>`,
+ Text: "Hi @1happyturtle, can I reply?",
+ CreatedAt: TimeMustParse("2024-02-20T12:41:37+02:00"),
+ UpdatedAt: TimeMustParse("2024-02-20T12:41:37+02:00"),
+ Local: util.Ptr(true),
+ AccountURI: "http://localhost:8080/users/admin",
+ MentionIDs: []string{"01J5QVP69ANF1K4WHES6GA4WXP"},
+ AccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
+ InReplyToID: "01F8MHC8VWDRBQR0N1BATDDEM5",
+ InReplyToAccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
+ InReplyToURI: "http://localhost:8080/users/1happyturtle/statuses/01F8MHC8VWDRBQR0N1BATDDEM5",
+ BoostOfID: "",
+ BoostOfAccountID: "",
+ ThreadID: "01HCWE4P0EW9HBA5WHW97D5YV0",
+ Visibility: gtsmodel.VisibilityUnlocked,
+ Sensitive: util.Ptr(false),
+ CreatedWithApplicationID: "01F8MGXQRHYF5QPMTMXP78QC2F",
+ Federated: util.Ptr(true),
+ ActivityStreamsType: ap.ObjectNote,
+ PendingApproval: util.Ptr(true),
+ },
"local_account_1_status_1": {
ID: "01F8MHAMCHF6Y650WCRSCP4WMY",
URI: "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY",
@@ -2298,6 +2323,10 @@ func NewTestThreadToStatus() []*gtsmodel.ThreadToStatus {
ThreadID: "01HCWE7ZNC2SS4P05WA5QYED23",
StatusID: "01G20ZM733MGN8J344T4ZDDFY1",
},
+ {
+ ThreadID: "01HCWE4P0EW9HBA5WHW97D5YV0",
+ StatusID: "01J5QVB9VC76NPPRQ207GG4DRZ",
+ },
}
}
@@ -2352,6 +2381,18 @@ func NewTestMentions() map[string]*gtsmodel.Mention {
TargetAccountURI: "http://localhost:8080/users/the_mighty_zork",
TargetAccountURL: "http://localhost:8080/@the_mighty_zork",
},
+ "admin_account_mention_turtle": {
+ ID: "01J5QVP69ANF1K4WHES6GA4WXP",
+ StatusID: "01J5QVB9VC76NPPRQ207GG4DRZ",
+ CreatedAt: TimeMustParse("2024-02-20T12:41:37+02:00"),
+ UpdatedAt: TimeMustParse("2024-02-20T12:41:37+02:00"),
+ OriginAccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
+ OriginAccountURI: "http://localhost:8080/users/admin",
+ TargetAccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
+ NameString: "@1happyturtle",
+ TargetAccountURI: "http://localhost:8080/users/1happyturtle",
+ TargetAccountURL: "http://localhost:8080/@1happyturtle",
+ },
"remote_account_2_mention_admin": {
ID: "01HE7XQNMKTVC8MNPCE1JGK4J3",
StatusID: "01HE7XJ1CG84TBKH5V9XKBVGF5",
@@ -3430,6 +3471,20 @@ func NewTestUserMutes() map[string]*gtsmodel.UserMute {
return map[string]*gtsmodel.UserMute{}
}
+func NewTestInteractionRequests() map[string]*gtsmodel.InteractionRequest {
+ return map[string]*gtsmodel.InteractionRequest{
+ "admin_account_reply_turtle": {
+ ID: "01J5QVXCCEATJYSXM9H6MZT4JR",
+ CreatedAt: TimeMustParse("2024-02-20T12:41:37+02:00"),
+ StatusID: "01F8MHC8VWDRBQR0N1BATDDEM5",
+ TargetAccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
+ InteractingAccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
+ InteractionURI: "http://localhost:8080/users/admin/statuses/01J5QVB9VC76NPPRQ207GG4DRZ",
+ InteractionType: gtsmodel.InteractionReply,
+ },
+ }
+}
+
// GetSignatureForActivity prepares a mock HTTP request as if it were going to deliver activity to destination signed for privkey and pubKeyID, signs the request and returns the header values.
func GetSignatureForActivity(activity pub.Activity, pubKeyID string, privkey *rsa.PrivateKey, destination *url.URL) (signatureHeader string, digestHeader string, dateHeader string) {
// convert the activity into json bytes