mirror of
1
Fork 0
gotosocial/testrig/testmodels.go

691 lines
28 KiB
Go
Raw Normal View History

2021-04-10 18:50:28 +02:00
/*
GoToSocial
Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2021-04-05 20:34:56 +02:00
package testrig
import (
"crypto/rand"
"crypto/rsa"
"net"
"time"
2021-04-08 23:29:35 +02:00
"github.com/superseriousbusiness/gotosocial/internal/db/gtsmodel"
2021-04-05 20:34:56 +02:00
"github.com/superseriousbusiness/gotosocial/internal/oauth"
)
2021-04-10 18:50:28 +02:00
// NewTestTokens returns a map of tokens keyed according to which account the token belongs to.
2021-04-10 13:34:41 +02:00
func NewTestTokens() map[string]*oauth.Token {
2021-04-05 20:34:56 +02:00
tokens := map[string]*oauth.Token{
"local_account_1": {
2021-04-08 23:29:35 +02:00
ID: "64cf4214-33ab-4220-b5ca-4a6a12263b20",
ClientID: "73b48d42-029d-4487-80fc-329a5cf67869",
UserID: "44e36b79-44a4-4bd8-91e9-097f477fe97b",
RedirectURI: "http://localhost:8080",
Scope: "read write follow push",
Access: "NZAZOTC0OWITMDU0NC0ZODG4LWE4NJITMWUXM2M4MTRHZDEX",
AccessCreateAt: time.Now(),
2021-04-06 16:31:57 +02:00
AccessExpiresAt: time.Now().Add(72 * time.Hour),
2021-04-05 20:34:56 +02:00
},
}
return tokens
}
2021-04-10 18:50:28 +02:00
// NewTestClients returns a map of Clients keyed according to which account they are used by.
2021-04-10 13:34:41 +02:00
func NewTestClients() map[string]*oauth.Client {
2021-04-05 20:34:56 +02:00
clients := map[string]*oauth.Client{
"local_account_1": {
ID: "73b48d42-029d-4487-80fc-329a5cf67869",
Secret: "c3724c74-dc3b-41b2-a108-0ea3d8399830",
Domain: "http://localhost:8080",
UserID: "44e36b79-44a4-4bd8-91e9-097f477fe97b", // local_account_1
},
}
return clients
}
2021-04-10 18:50:28 +02:00
// NewTestApplications returns a map of applications keyed to which number application they are.
2021-04-10 13:34:41 +02:00
func NewTestApplications() map[string]*gtsmodel.Application {
2021-04-08 23:29:35 +02:00
apps := map[string]*gtsmodel.Application{
2021-04-05 20:34:56 +02:00
"application_1": {
ID: "f88697b8-ee3d-46c2-ac3f-dbb85566c3cc",
Name: "really cool gts application",
Website: "https://reallycool.app",
RedirectURI: "http://localhost:8080",
ClientID: "73b48d42-029d-4487-80fc-329a5cf67869", // client_1
ClientSecret: "c3724c74-dc3b-41b2-a108-0ea3d8399830", // client_1
Scopes: "read write follow push",
VapidKey: "4738dfd7-ca73-4aa6-9aa9-80e946b7db36",
},
}
return apps
}
2021-04-10 18:50:28 +02:00
// NewTestUsers returns a map of Users keyed by which account belongs to them.
2021-04-10 13:34:41 +02:00
func NewTestUsers() map[string]*gtsmodel.User {
2021-04-08 23:29:35 +02:00
users := map[string]*gtsmodel.User{
2021-04-05 20:34:56 +02:00
"unconfirmed_account": {
ID: "0f7b1d24-1e49-4ee0-bc7e-fd87b7289eea",
Email: "",
AccountID: "59e197f5-87cd-4be8-ac7c-09082ccc4b4d",
EncryptedPassword: "$2y$10$ggWz5QWwnx6kzb9g0tnIJurFtE0dhr5Zfeaqs9iFuUIXzafQlJVZS", // 'password'
CreatedAt: time.Now(),
SignUpIP: net.ParseIP("199.222.111.89"),
UpdatedAt: time.Time{},
CurrentSignInAt: time.Time{},
CurrentSignInIP: nil,
LastSignInAt: time.Time{},
LastSignInIP: nil,
SignInCount: 0,
InviteID: "",
ChosenLanguages: []string{},
FilteredLanguages: []string{},
Locale: "en",
CreatedByApplicationID: "",
LastEmailedAt: time.Time{},
ConfirmationToken: "a5a280bd-34be-44a3-8330-a57eaf61b8dd",
ConfirmedAt: time.Time{},
ConfirmationSentAt: time.Now(),
UnconfirmedEmail: "weed_lord420@example.org",
Moderator: false,
Admin: false,
Disabled: false,
Approved: false,
ResetPasswordToken: "",
ResetPasswordSentAt: time.Time{},
},
"admin_account": {
ID: "0fb02eae-2214-473f-9667-0a43f22d75ff",
Email: "admin@example.org",
AccountID: "8020dbb4-1e7b-4d99-a872-4cf94e64210f",
EncryptedPassword: "$2y$10$ggWz5QWwnx6kzb9g0tnIJurFtE0dhr5Zfeaqs9iFuUIXzafQlJVZS", // 'password'
CreatedAt: time.Now().Add(-72 * time.Hour),
SignUpIP: net.ParseIP("89.22.189.19"),
UpdatedAt: time.Now().Add(-72 * time.Hour),
CurrentSignInAt: time.Now().Add(-10 * time.Minute),
CurrentSignInIP: net.ParseIP("89.122.255.1"),
LastSignInAt: time.Now().Add(-2 * time.Hour),
LastSignInIP: net.ParseIP("89.122.255.1"),
SignInCount: 78,
InviteID: "",
ChosenLanguages: []string{"en"},
FilteredLanguages: []string{},
Locale: "en",
CreatedByApplicationID: "",
LastEmailedAt: time.Now().Add(-30 * time.Minute),
ConfirmationToken: "",
ConfirmedAt: time.Time{},
ConfirmationSentAt: time.Time{},
UnconfirmedEmail: "",
Moderator: true,
Admin: true,
Disabled: false,
Approved: true,
ResetPasswordToken: "",
ResetPasswordSentAt: time.Time{},
},
"local_account_1": {
ID: "44e36b79-44a4-4bd8-91e9-097f477fe97b",
Email: "zork@example.org",
AccountID: "580072df-4d03-4684-a412-89fd6f7d77e6",
EncryptedPassword: "$2y$10$ggWz5QWwnx6kzb9g0tnIJurFtE0dhr5Zfeaqs9iFuUIXzafQlJVZS", // 'password'
CreatedAt: time.Now().Add(-36 * time.Hour),
SignUpIP: net.ParseIP("59.99.19.172"),
UpdatedAt: time.Now().Add(-72 * time.Hour),
CurrentSignInAt: time.Now().Add(-30 * time.Minute),
CurrentSignInIP: net.ParseIP("88.234.118.16"),
LastSignInAt: time.Now().Add(-2 * time.Hour),
LastSignInIP: net.ParseIP("147.111.231.154"),
SignInCount: 9,
InviteID: "",
ChosenLanguages: []string{"en"},
FilteredLanguages: []string{},
Locale: "en",
2021-04-06 16:31:57 +02:00
CreatedByApplicationID: "f88697b8-ee3d-46c2-ac3f-dbb85566c3cc",
2021-04-05 20:34:56 +02:00
LastEmailedAt: time.Now().Add(-55 * time.Minute),
ConfirmationToken: "",
ConfirmedAt: time.Now().Add(-34 * time.Hour),
ConfirmationSentAt: time.Now().Add(-36 * time.Hour),
UnconfirmedEmail: "",
Moderator: false,
Admin: false,
Disabled: false,
Approved: true,
ResetPasswordToken: "",
ResetPasswordSentAt: time.Time{},
},
"local_account_2": {
ID: "f8d6272e-2d71-4d0c-97d3-2ba7a0b75bf7",
Email: "tortle.dude@example.org",
AccountID: "eecaad73-5703-426d-9312-276641daa31e",
EncryptedPassword: "$2y$10$ggWz5QWwnx6kzb9g0tnIJurFtE0dhr5Zfeaqs9iFuUIXzafQlJVZS", // 'password'
CreatedAt: time.Now().Add(-36 * time.Hour),
SignUpIP: net.ParseIP("59.99.19.172"),
UpdatedAt: time.Now().Add(-72 * time.Hour),
CurrentSignInAt: time.Now().Add(-30 * time.Minute),
CurrentSignInIP: net.ParseIP("118.44.18.196"),
LastSignInAt: time.Now().Add(-2 * time.Hour),
LastSignInIP: net.ParseIP("198.98.21.15"),
SignInCount: 9,
InviteID: "",
ChosenLanguages: []string{"en"},
FilteredLanguages: []string{},
Locale: "en",
CreatedByApplicationID: "",
LastEmailedAt: time.Now().Add(-55 * time.Minute),
ConfirmationToken: "",
ConfirmedAt: time.Now().Add(-34 * time.Hour),
ConfirmationSentAt: time.Now().Add(-36 * time.Hour),
UnconfirmedEmail: "",
Moderator: false,
Admin: false,
Disabled: false,
Approved: true,
ResetPasswordToken: "",
ResetPasswordSentAt: time.Time{},
},
}
return users
}
2021-04-10 18:50:28 +02:00
// NewTestAccounts returns a map of accounts keyed by what type of account they are.
2021-04-10 13:34:41 +02:00
func NewTestAccounts() map[string]*gtsmodel.Account {
2021-04-08 23:29:35 +02:00
accounts := map[string]*gtsmodel.Account{
2021-04-05 20:34:56 +02:00
"unconfirmed_account": {
ID: "59e197f5-87cd-4be8-ac7c-09082ccc4b4d",
Username: "weed_lord420",
AvatarFileName: "",
AvatarContentType: "",
AvatarFileSize: 0,
AvatarUpdatedAt: time.Time{},
AvatarRemoteURL: "",
HeaderFileName: "",
HeaderContentType: "",
HeaderFileSize: 0,
HeaderUpdatedAt: time.Time{},
HeaderRemoteURL: "",
DisplayName: "",
2021-04-08 23:29:35 +02:00
Fields: []gtsmodel.Field{},
2021-04-05 20:34:56 +02:00
Note: "",
Memorial: false,
MovedToAccountID: "",
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
Bot: false,
Reason: "hi, please let me in! I'm looking for somewhere neato bombeato to hang out.",
Locked: false,
Discoverable: false,
2021-04-08 23:29:35 +02:00
Privacy: gtsmodel.VisibilityPublic,
2021-04-05 20:34:56 +02:00
Sensitive: false,
Language: "en",
2021-04-06 16:31:57 +02:00
URI: "http://localhost:8080/users/weed_lord420",
URL: "http://localhost:8080/@weed_lord420",
2021-04-05 20:34:56 +02:00
LastWebfingeredAt: time.Time{},
2021-04-06 16:31:57 +02:00
InboxURL: "http://localhost:8080/users/weed_lord420/inbox",
OutboxURL: "http://localhost:8080/users/weed_lord420/outbox",
2021-04-05 20:34:56 +02:00
SharedInboxURL: "",
2021-04-06 16:31:57 +02:00
FollowersURL: "http://localhost:8080/users/weed_lord420/followers",
FeaturedCollectionURL: "http://localhost:8080/users/weed_lord420/collections/featured",
2021-04-08 23:29:35 +02:00
ActorType: gtsmodel.ActivityStreamsPerson,
2021-04-05 20:34:56 +02:00
AlsoKnownAs: "",
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
HideCollections: false,
SuspensionOrigin: "",
},
"admin_account": {
ID: "8020dbb4-1e7b-4d99-a872-4cf94e64210f",
Username: "admin",
AvatarFileName: "",
AvatarContentType: "",
AvatarFileSize: 0,
AvatarUpdatedAt: time.Time{},
AvatarRemoteURL: "",
HeaderFileName: "",
HeaderContentType: "",
HeaderFileSize: 0,
HeaderUpdatedAt: time.Time{},
HeaderRemoteURL: "",
DisplayName: "",
2021-04-08 23:29:35 +02:00
Fields: []gtsmodel.Field{},
2021-04-05 20:34:56 +02:00
Note: "",
Memorial: false,
MovedToAccountID: "",
CreatedAt: time.Now().Add(-72 * time.Hour),
UpdatedAt: time.Now().Add(-72 * time.Hour),
Bot: false,
Reason: "",
Locked: false,
Discoverable: true,
2021-04-08 23:29:35 +02:00
Privacy: gtsmodel.VisibilityPublic,
2021-04-05 20:34:56 +02:00
Sensitive: false,
Language: "en",
URI: "http://localhost:8080/users/admin",
URL: "http://localhost:8080/@admin",
LastWebfingeredAt: time.Time{},
InboxURL: "http://localhost:8080/users/admin/inbox",
OutboxURL: "http://localhost:8080/users/admin/outbox",
SharedInboxURL: "",
FollowersURL: "http://localhost:8080/users/admin/followers",
FeaturedCollectionURL: "http://localhost:8080/users/admin/collections/featured",
2021-04-08 23:29:35 +02:00
ActorType: gtsmodel.ActivityStreamsPerson,
2021-04-05 20:34:56 +02:00
AlsoKnownAs: "",
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
HideCollections: false,
SuspensionOrigin: "",
},
"local_account_1": {
ID: "580072df-4d03-4684-a412-89fd6f7d77e6",
Username: "the_mighty_zork",
AvatarFileName: "http://localhost:8080/fileserver/media/580072df-4d03-4684-a412-89fd6f7d77e6/avatar/original/75cfbe52-a5fb-451b-8f5a-b023229dce8d.jpeg",
AvatarContentType: "image/jpeg",
AvatarFileSize: 0,
AvatarUpdatedAt: time.Time{},
AvatarRemoteURL: "",
HeaderFileName: "http://localhost:8080/fileserver/media/580072df-4d03-4684-a412-89fd6f7d77e6/header/original/9651c1ed-c288-4063-a95c-c7f8ff2a633f.jpeg",
HeaderContentType: "image/jpeg",
HeaderFileSize: 0,
HeaderUpdatedAt: time.Time{},
HeaderRemoteURL: "",
DisplayName: "original zork (he/they)",
2021-04-08 23:29:35 +02:00
Fields: []gtsmodel.Field{},
2021-04-05 20:34:56 +02:00
Note: "hey yo this is my profile!",
Memorial: false,
MovedToAccountID: "",
CreatedAt: time.Now().Add(-48 * time.Hour),
UpdatedAt: time.Now().Add(-48 * time.Hour),
Bot: false,
Reason: "I wanna be on this damned webbed site so bad! Please! Wow",
Locked: false,
Discoverable: true,
2021-04-08 23:29:35 +02:00
Privacy: gtsmodel.VisibilityPublic,
2021-04-05 20:34:56 +02:00
Sensitive: false,
Language: "en",
URI: "http://localhost:8080/users/the_mighty_zork",
URL: "http://localhost:8080/@the_mighty_zork",
LastWebfingeredAt: time.Time{},
InboxURL: "http://localhost:8080/users/the_mighty_zork/inbox",
OutboxURL: "http://localhost:8080/users/the_mighty_zork/outbox",
SharedInboxURL: "",
FollowersURL: "http://localhost:8080/users/the_mighty_zork/followers",
FeaturedCollectionURL: "http://localhost:8080/users/the_mighty_zork/collections/featured",
2021-04-08 23:29:35 +02:00
ActorType: gtsmodel.ActivityStreamsPerson,
2021-04-05 20:34:56 +02:00
AlsoKnownAs: "",
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
HideCollections: false,
SuspensionOrigin: "",
},
"local_account_2": {
ID: "eecaad73-5703-426d-9312-276641daa31e",
Username: "1happyturtle",
AvatarFileName: "http://localhost:8080/fileserver/media/eecaad73-5703-426d-9312-276641daa31e/avatar/original/d5e7c265-91a6-4d84-8c27-7e1efe5720da.jpeg",
AvatarContentType: "image/jpeg",
AvatarFileSize: 0,
AvatarUpdatedAt: time.Time{},
AvatarRemoteURL: "",
HeaderFileName: "http://localhost:8080/fileserver/media/eecaad73-5703-426d-9312-276641daa31e/header/original/e75d4117-21b6-4315-a428-eb3944235996.jpeg",
HeaderContentType: "image/jpeg",
HeaderFileSize: 0,
HeaderUpdatedAt: time.Time{},
HeaderRemoteURL: "",
DisplayName: "happy little turtle :3",
2021-04-08 23:29:35 +02:00
Fields: []gtsmodel.Field{},
2021-04-05 20:34:56 +02:00
Note: "i post about things that concern me",
Memorial: false,
MovedToAccountID: "",
CreatedAt: time.Now().Add(-190 * time.Hour),
UpdatedAt: time.Now().Add(-36 * time.Hour),
Bot: false,
Reason: "",
Locked: true,
Discoverable: false,
2021-04-08 23:29:35 +02:00
Privacy: gtsmodel.VisibilityFollowersOnly,
2021-04-05 20:34:56 +02:00
Sensitive: false,
Language: "en",
URI: "http://localhost:8080/users/1happyturtle",
URL: "http://localhost:8080/@1happyturtle",
LastWebfingeredAt: time.Time{},
InboxURL: "http://localhost:8080/users/1happyturtle/inbox",
OutboxURL: "http://localhost:8080/users/1happyturtle/outbox",
SharedInboxURL: "",
FollowersURL: "http://localhost:8080/users/1happyturtle/followers",
FeaturedCollectionURL: "http://localhost:8080/users/1happyturtle/collections/featured",
2021-04-08 23:29:35 +02:00
ActorType: gtsmodel.ActivityStreamsPerson,
2021-04-05 20:34:56 +02:00
AlsoKnownAs: "",
PrivateKey: &rsa.PrivateKey{},
PublicKey: &rsa.PublicKey{},
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
HideCollections: false,
SuspensionOrigin: "",
},
"remote_account_1": {
ID: "c2c6e647-e2a9-4286-883b-e4a188186664",
Username: "foss_satan",
Domain: "fossbros-anonymous.io",
2021-04-06 16:31:57 +02:00
// AvatarFileName: "http://localhost:8080/fileserver/media/eecaad73-5703-426d-9312-276641daa31e/avatar/original/d5e7c265-91a6-4d84-8c27-7e1efe5720da.jpeg",
// AvatarContentType: "image/jpeg",
// AvatarFileSize: 0,
// AvatarUpdatedAt: time.Time{},
// AvatarRemoteURL: "",
// HeaderFileName: "http://localhost:8080/fileserver/media/eecaad73-5703-426d-9312-276641daa31e/header/original/e75d4117-21b6-4315-a428-eb3944235996.jpeg",
// HeaderContentType: "image/jpeg",
// HeaderFileSize: 0,
// HeaderUpdatedAt: time.Time{},
// HeaderRemoteURL: "",
DisplayName: "big gerald",
2021-04-08 23:29:35 +02:00
Fields: []gtsmodel.Field{},
2021-04-07 13:26:02 +02:00
Note: "i post about like, i dunno, stuff, or whatever!!!!",
2021-04-06 16:31:57 +02:00
Memorial: false,
MovedToAccountID: "",
CreatedAt: time.Now().Add(-190 * time.Hour),
UpdatedAt: time.Now().Add(-36 * time.Hour),
Bot: false,
Locked: false,
Discoverable: true,
Sensitive: false,
Language: "en",
URI: "https://fossbros-anonymous.io/users/foss_satan",
URL: "https://fossbros-anonymous.io/@foss_satan",
LastWebfingeredAt: time.Time{},
InboxURL: "https://fossbros-anonymous.io/users/foss_satan/inbox",
OutboxURL: "https://fossbros-anonymous.io/users/foss_satan/outbox",
SharedInboxURL: "",
FollowersURL: "https://fossbros-anonymous.io/users/foss_satan/followers",
FeaturedCollectionURL: "https://fossbros-anonymous.io/users/foss_satan/collections/featured",
2021-04-08 23:29:35 +02:00
ActorType: gtsmodel.ActivityStreamsPerson,
2021-04-06 16:31:57 +02:00
AlsoKnownAs: "",
PrivateKey: &rsa.PrivateKey{},
PublicKey: nil,
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
HideCollections: false,
SuspensionOrigin: "",
2021-04-05 20:34:56 +02:00
},
2021-04-06 16:31:57 +02:00
// "remote_account_2": {
// ID: "93287988-76c4-460f-9e68-a45b578bb6b2",
// Username: "dailycatpics",
// Domain: "uwu.social",
// },
// "suspended_local_account": {
// ID: "e8a5cf4e-4b10-45a4-ad82-b6e37a09100d",
// Username: "jeffbadman",
// },
// "suspended_remote_account": {
// ID: "17e6e09e-855d-4bf8-a1c3-7e780269f215",
// Username: "ipfreely",
// Domain: "a-very-bad-website.com",
// },
2021-04-05 20:34:56 +02:00
}
// generate keys for each account
for _, v := range accounts {
priv, err := rsa.GenerateKey(rand.Reader, 2048)
if err != nil {
panic(err)
}
pub := &priv.PublicKey
// only local accounts get a private key
if v.Domain == "" {
v.PrivateKey = priv
}
v.PublicKey = pub
}
return accounts
}
2021-04-07 13:26:02 +02:00
2021-04-10 18:50:28 +02:00
// NewTestAttachments returns a map of attachments keyed according to which account
// and status they belong to, and which attachment number of that status they are.
2021-04-10 13:34:41 +02:00
func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
2021-04-09 17:21:53 +02:00
return map[string]*gtsmodel.MediaAttachment{
2021-04-10 18:50:28 +02:00
"admin_account_status_1_attachment_1": {
ID: "b052241b-f30f-4dc6-92fc-2bad0be1f8d8",
StatusID: "502ccd6f-0edf-48d7-9016-2dfa4d3714cd",
URL: "http://localhost:8080/fileserver/8020dbb4-1e7b-4d99-a872-4cf94e64210f/attachment/original/b052241b-f30f-4dc6-92fc-2bad0be1f8d8.jpeg",
RemoteURL: "",
2021-04-11 19:53:22 +02:00
CreatedAt: time.Now().Add(-71 * time.Hour),
UpdatedAt: time.Now().Add(-71 * time.Hour),
2021-04-10 18:50:28 +02:00
Type: gtsmodel.FileTypeImage,
FileMeta: gtsmodel.FileMeta{
Original: gtsmodel.Original{
Width: 1200,
Height: 630,
Size: 756000,
Aspect: 1.9047619047619047,
},
Small: gtsmodel.Small{
Width: 256,
Height: 134,
Size: 34304,
Aspect: 1.9104477611940298,
},
},
AccountID: "8020dbb4-1e7b-4d99-a872-4cf94e64210f",
Description: "Black and white image of some 50's style text saying: Welcome On Board",
ScheduledStatusID: "",
Blurhash: "LNJRdVM{00Rj%Mayt7j[4nWBofRj",
Processing: 2,
File: gtsmodel.File{
Path: "/gotosocial/storage/8020dbb4-1e7b-4d99-a872-4cf94e64210f/attachment/original/b052241b-f30f-4dc6-92fc-2bad0be1f8d8.jpeg",
ContentType: "image/jpeg",
FileSize: 62529,
UpdatedAt: time.Now().Add(-71 * time.Hour),
},
Thumbnail: gtsmodel.Thumbnail{
Path: "/gotosocial/storage/8020dbb4-1e7b-4d99-a872-4cf94e64210f/attachment/small/b052241b-f30f-4dc6-92fc-2bad0be1f8d8.jpeg",
ContentType: "image/jpeg",
FileSize: 6872,
UpdatedAt: time.Now().Add(-71 * time.Hour),
URL: "http://localhost:8080/fileserver/8020dbb4-1e7b-4d99-a872-4cf94e64210f/attachment/small/b052241b-f30f-4dc6-92fc-2bad0be1f8d8.jpeg",
RemoteURL: "",
},
Avatar: false,
Header: false,
},
}
}
2021-04-09 17:21:53 +02:00
2021-04-10 18:50:28 +02:00
// NewTestStored returns a map of filenames, keyed according to which attachment they pertain to.
func NewTestStored() map[string]string {
2021-04-11 19:53:22 +02:00
return map[string]string{
2021-04-10 18:50:28 +02:00
"admin_account_status_1_attachment_1": "welcome-*.jpeg",
2021-04-09 17:21:53 +02:00
}
}
2021-04-10 18:50:28 +02:00
// NewTestStatuses returns a map of statuses keyed according to which account
// and status they are.
2021-04-10 13:34:41 +02:00
func NewTestStatuses() map[string]*gtsmodel.Status {
2021-04-08 23:29:35 +02:00
return map[string]*gtsmodel.Status{
"admin_account_status_1": {
ID: "502ccd6f-0edf-48d7-9016-2dfa4d3714cd",
URI: "http://localhost:8080/users/admin/statuses/502ccd6f-0edf-48d7-9016-2dfa4d3714cd",
URL: "http://localhost:8080/@admin/statuses/502ccd6f-0edf-48d7-9016-2dfa4d3714cd",
Content: "hello world! first post on the instance!",
CreatedAt: time.Now().Add(-71 * time.Hour),
UpdatedAt: time.Now().Add(-71 * time.Hour),
Local: true,
AccountID: "0fb02eae-2214-473f-9667-0a43f22d75ff",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: false,
Language: "en",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: true,
Replyable: true,
Likeable: true,
},
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
},
"admin_account_status_2": {
ID: "0fb3f1ac-5cd8-48ac-9050-3d95dc7e44e9",
URI: "http://localhost:8080/users/admin/statuses/0fb3f1ac-5cd8-48ac-9050-3d95dc7e44e9",
URL: "http://localhost:8080/@admin/statuses/0fb3f1ac-5cd8-48ac-9050-3d95dc7e44e9",
Content: "🐕🐕🐕🐕🐕",
CreatedAt: time.Now().Add(-70 * time.Hour),
UpdatedAt: time.Now().Add(-70 * time.Hour),
Local: true,
AccountID: "0fb02eae-2214-473f-9667-0a43f22d75ff",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "open to see some puppies",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: true,
Language: "en",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: true,
Replyable: true,
Likeable: true,
},
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
},
2021-04-07 13:26:02 +02:00
"local_account_1_status_1": {
2021-04-08 23:29:35 +02:00
ID: "91b1e795-74ff-4672-a4c4-476616710e2d",
URI: "http://localhost:8080/users/the_mighty_zork/statuses/91b1e795-74ff-4672-a4c4-476616710e2d",
URL: "http://localhost:8080/@the_mighty_zork/statuses/91b1e795-74ff-4672-a4c4-476616710e2d",
Content: "hello everyone!",
CreatedAt: time.Now().Add(-47 * time.Hour),
UpdatedAt: time.Now().Add(-47 * time.Hour),
Local: true,
AccountID: "580072df-4d03-4684-a412-89fd6f7d77e6",
InReplyToID: "",
BoostOfID: "",
2021-04-07 13:26:02 +02:00
ContentWarning: "introduction post",
2021-04-08 23:29:35 +02:00
Visibility: gtsmodel.VisibilityPublic,
Sensitive: true,
Language: "en",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
2021-04-07 13:26:02 +02:00
Federated: true,
Boostable: true,
Replyable: true,
2021-04-08 23:29:35 +02:00
Likeable: true,
2021-04-07 13:26:02 +02:00
},
2021-04-08 23:29:35 +02:00
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
2021-04-07 13:26:02 +02:00
},
"local_account_1_status_2": {
2021-04-08 23:29:35 +02:00
ID: "3dd328d9-8bb1-48f5-bc96-5ccc1c696b4c",
URI: "http://localhost:8080/users/the_mighty_zork/statuses/3dd328d9-8bb1-48f5-bc96-5ccc1c696b4c",
URL: "http://localhost:8080/@the_mighty_zork/statuses/3dd328d9-8bb1-48f5-bc96-5ccc1c696b4c",
Content: "this is an unlocked local-only post that shouldn't federate, but it's still boostable, replyable, and likeable",
CreatedAt: time.Now().Add(-46 * time.Hour),
UpdatedAt: time.Now().Add(-46 * time.Hour),
Local: true,
AccountID: "580072df-4d03-4684-a412-89fd6f7d77e6",
InReplyToID: "",
BoostOfID: "",
2021-04-07 13:26:02 +02:00
ContentWarning: "",
2021-04-08 23:29:35 +02:00
Visibility: gtsmodel.VisibilityUnlocked,
Sensitive: false,
Language: "en",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
2021-04-07 13:26:02 +02:00
Federated: false,
Boostable: true,
Replyable: true,
2021-04-08 23:29:35 +02:00
Likeable: true,
},
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
},
"local_account_1_status_3": {
ID: "5e41963f-8ab9-4147-9f00-52d56e19da65",
URI: "http://localhost:8080/users/the_mighty_zork/statuses/5e41963f-8ab9-4147-9f00-52d56e19da65",
URL: "http://localhost:8080/@the_mighty_zork/statuses/5e41963f-8ab9-4147-9f00-52d56e19da65",
Content: "this is a very personal post that I don't want anyone to interact with at all, and i only want mutuals to see it",
CreatedAt: time.Now().Add(-45 * time.Hour),
UpdatedAt: time.Now().Add(-45 * time.Hour),
Local: true,
AccountID: "580072df-4d03-4684-a412-89fd6f7d77e6",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "test: you shouldn't be able to interact with this post in any way",
Visibility: gtsmodel.VisibilityMutualsOnly,
Sensitive: false,
Language: "en",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: false,
Replyable: false,
Likeable: false,
},
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
},
"local_account_2_status_1": {
ID: "8945ccf2-3873-45e9-aa13-fd7163f19775",
URI: "http://localhost:8080/users/1happyturtle/statuses/8945ccf2-3873-45e9-aa13-fd7163f19775",
URL: "http://localhost:8080/@1happyturtle/statuses/8945ccf2-3873-45e9-aa13-fd7163f19775",
Content: "🐢 hi everyone i post about turtles 🐢",
CreatedAt: time.Now().Add(-189 * time.Hour),
UpdatedAt: time.Now().Add(-189 * time.Hour),
Local: true,
AccountID: "eecaad73-5703-426d-9312-276641daa31e",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "introduction post",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: true,
Language: "en",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: true,
Replyable: true,
Likeable: true,
},
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
},
"local_account_2_status_2": {
ID: "c7e25a86-f0d3-4705-a73c-c597f687d3dd",
URI: "http://localhost:8080/users/1happyturtle/statuses/c7e25a86-f0d3-4705-a73c-c597f687d3dd",
URL: "http://localhost:8080/@1happyturtle/statuses/c7e25a86-f0d3-4705-a73c-c597f687d3dd",
Content: "🐢 this one is federated, likeable, and boostable but not replyable 🐢",
CreatedAt: time.Now().Add(-1 * time.Minute),
UpdatedAt: time.Now().Add(-1 * time.Minute),
Local: true,
AccountID: "eecaad73-5703-426d-9312-276641daa31e",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: true,
Language: "en",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: true,
Replyable: false,
Likeable: true,
2021-04-07 13:26:02 +02:00
},
2021-04-08 23:29:35 +02:00
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
2021-04-07 13:26:02 +02:00
},
}
}