mirror of
1
Fork 0

Testrig fixes (#50)

* testrig is runnable again
* little fixes, add some more test models
* address https://github.com/superseriousbusiness/gotosocial/issues/44
This commit is contained in:
Tobi Smethurst 2021-06-21 12:27:23 +02:00 committed by GitHub
parent aa8a0d0850
commit efbd839181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 379 additions and 209 deletions

View File

@ -56,6 +56,42 @@ docker run -d --user postgres --network host sosedoff/pgweb
This will launch a pgweb at `http://localhost:8081`.
### Standalone Testrig
You can also launch a testrig as a standalone server running at localhost, which you can connect to using something like [Pinafore](https://github.com/nolanlawson/pinafore).
To do this, first build the gotosocial binary with `go build ./cmd/gotosocial`.
Then launch a clean Postgres container on localhost:
```bash
docker run -d --user postgres --network host -e POSTGRES_PASSWORD=postgres postgres
```
Then, launch the testrig by invoking the binary as follows:
```bash
./gotosocial --host localhost:8080 testrig start
```
To run Pinafore locally in dev mode, first clone the Pinafore repository, and run the following command in the cloned directory:
```bash
yarn run dev
```
The Pinafore instance will start running on `localhost:4002`.
To connect to the testrig, navigate to `https://localhost:4002` and enter your instance name as `localhost:8080`.
At the login screen, enter the email address `zork@example.org` and password `password`.
Note the following constraints:
- The testrig data will be destroyed when the testrig is destroyed. It does this by dropping all tables in Postgres on shutdown. As such, you should **NEVER RUN THE TESTRIG AGAINST A DATABASE WITH REAL DATA IN IT** because it will be destroyed. Be especially careful if you're forwarding database ports from a remote instance to your local machine, because you can easily and irreversibly nuke that data if you run the testrig against it.
- If you stop the testrig and start it again, any tokens or applications you created during your tests will also be removed. As such, you need to log out and in again every time you stop/start the rig.
- The testrig does not make any actual external http calls, so federation will (obviously) not work from a testrig.
## Running tests
Because the tests use a real Postgres under the hood, you can't run them in parallel, so you need to run tests with the following command:
@ -98,4 +134,4 @@ Then make sure to run `go fmt ./...` to update whitespace and other opinionated
Right now there's no structure in place for financial compensation for pull requests and code. This is simply because there's no money being made on the project apart from the very small weekly Liberapay donations.
If money starts coming in, I'll start looking at proper financial structures, but for now code is considered to be a donation in itself.
If money starts coming in, I'll start looking at proper financial structures, but for now code is considered to be a donation in itself.

View File

@ -26,9 +26,9 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/cliactions"
"github.com/superseriousbusiness/gotosocial/internal/cliactions/admin/account"
"github.com/superseriousbusiness/gotosocial/internal/cliactions/server"
"github.com/superseriousbusiness/gotosocial/internal/cliactions/testrig"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/log"
"github.com/superseriousbusiness/gotosocial/testrig"
"github.com/urfave/cli/v2"
)
@ -361,19 +361,6 @@ func main() {
},
},
},
// {
// Name: "db",
// Usage: "database-related tasks and utils",
// Subcommands: []*cli.Command{
// {
// Name: "init",
// Usage: "initialize a database with the required schema for gotosocial; has no effect & is safe to run on an already-initialized db",
// Action: func(c *cli.Context) error {
// return runAction(c, db.Initialize)
// },
// },
// },
// },
{
Name: "testrig",
Usage: "gotosocial testrig tasks",
@ -382,7 +369,7 @@ func main() {
Name: "start",
Usage: "start the gotosocial testrig",
Action: func(c *cli.Context) error {
return runAction(c, testrig.Run)
return runAction(c, testrig.Start)
},
},
},

View File

@ -1,21 +1,3 @@
/*
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/>.
*/
package testrig
import (
@ -34,50 +16,72 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/api/client/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/app"
"github.com/superseriousbusiness/gotosocial/internal/api/client/auth"
"github.com/superseriousbusiness/gotosocial/internal/api/client/emoji"
"github.com/superseriousbusiness/gotosocial/internal/api/client/fileserver"
"github.com/superseriousbusiness/gotosocial/internal/api/client/filter"
"github.com/superseriousbusiness/gotosocial/internal/api/client/followrequest"
"github.com/superseriousbusiness/gotosocial/internal/api/client/instance"
"github.com/superseriousbusiness/gotosocial/internal/api/client/list"
mediaModule "github.com/superseriousbusiness/gotosocial/internal/api/client/media"
"github.com/superseriousbusiness/gotosocial/internal/api/client/notification"
"github.com/superseriousbusiness/gotosocial/internal/api/client/search"
"github.com/superseriousbusiness/gotosocial/internal/api/client/status"
"github.com/superseriousbusiness/gotosocial/internal/api/client/streaming"
"github.com/superseriousbusiness/gotosocial/internal/api/client/timeline"
"github.com/superseriousbusiness/gotosocial/internal/api/s2s/user"
"github.com/superseriousbusiness/gotosocial/internal/api/s2s/webfinger"
"github.com/superseriousbusiness/gotosocial/internal/api/security"
"github.com/superseriousbusiness/gotosocial/internal/cliactions"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/federation"
"github.com/superseriousbusiness/gotosocial/internal/gotosocial"
"github.com/superseriousbusiness/gotosocial/testrig"
)
// Run creates and starts a gotosocial testrig server
var Run cliactions.GTSAction = func(ctx context.Context, _ *config.Config, log *logrus.Logger) error {
c := NewTestConfig()
dbService := NewTestDB()
federatingDB := NewTestFederatingDB(dbService)
router := NewTestRouter()
storageBackend := NewTestStorage()
// Start creates and starts a gotosocial testrig server
var Start cliactions.GTSAction = func(ctx context.Context, _ *config.Config, log *logrus.Logger) error {
c := testrig.NewTestConfig()
dbService := testrig.NewTestDB()
testrig.StandardDBSetup(dbService)
router := testrig.NewTestRouter()
storageBackend := testrig.NewTestStorage()
testrig.StandardStorageSetup(storageBackend, "./testrig/media")
typeConverter := NewTestTypeConverter(dbService)
transportController := NewTestTransportController(NewMockHTTPClient(func(req *http.Request) (*http.Response, error) {
// build backend handlers
oauthServer := testrig.NewTestOauthServer(dbService)
transportController := testrig.NewTestTransportController(testrig.NewMockHTTPClient(func(req *http.Request) (*http.Response, error) {
r := ioutil.NopCloser(bytes.NewReader([]byte{}))
return &http.Response{
StatusCode: 200,
Body: r,
}, nil
}))
federator := federation.NewFederator(dbService, federatingDB, transportController, c, log, typeConverter)
processor := NewTestProcessor(dbService, storageBackend, federator)
federator := testrig.NewTestFederator(dbService, transportController)
processor := testrig.NewTestProcessor(dbService, storageBackend, federator)
if err := processor.Start(); err != nil {
return fmt.Errorf("error starting processor: %s", err)
}
StandardDBSetup(dbService)
StandardStorageSetup(storageBackend, "./testrig/media")
// build client api modules
authModule := auth.New(c, dbService, NewTestOauthServer(dbService), log)
authModule := auth.New(c, dbService, oauthServer, log)
accountModule := account.New(c, processor, log)
instanceModule := instance.New(c, processor, log)
appsModule := app.New(c, processor, log)
followRequestsModule := followrequest.New(c, processor, log)
webfingerModule := webfinger.New(c, processor, log)
usersModule := user.New(c, processor, log)
timelineModule := timeline.New(c, processor, log)
notificationModule := notification.New(c, processor, log)
searchModule := search.New(c, processor, log)
filtersModule := filter.New(c, processor, log)
emojiModule := emoji.New(c, processor, log)
listsModule := list.New(c, processor, log)
mm := mediaModule.New(c, processor, log)
fileServerModule := fileserver.New(c, processor, log)
adminModule := admin.New(c, processor, log)
statusModule := status.New(c, processor, log)
securityModule := security.New(c, log)
streamingModule := streaming.New(c, processor, log)
apis := []api.ClientModule{
// modules with middleware go first
@ -86,11 +90,22 @@ var Run cliactions.GTSAction = func(ctx context.Context, _ *config.Config, log *
// now everything else
accountModule,
instanceModule,
appsModule,
followRequestsModule,
mm,
fileServerModule,
adminModule,
statusModule,
webfingerModule,
usersModule,
timelineModule,
notificationModule,
searchModule,
filtersModule,
emojiModule,
listsModule,
streamingModule,
}
for _, m := range apis {
@ -114,8 +129,8 @@ var Run cliactions.GTSAction = func(ctx context.Context, _ *config.Config, log *
sig := <-sigs
log.Infof("received signal %s, shutting down", sig)
StandardDBTeardown(dbService)
StandardStorageTeardown(storageBackend)
testrig.StandardDBTeardown(dbService)
testrig.StandardStorageTeardown(storageBackend)
// close down all running services in order
if err := gts.Stop(ctx); err != nil {

View File

@ -1,6 +1,7 @@
package timeline
import (
"container/list"
"errors"
"fmt"
@ -31,6 +32,17 @@ func (t *timeline) PrepareBehind(statusID string, amount int) error {
t.Lock()
defer t.Unlock()
// lazily initialize prepared posts if it hasn't been done already
if t.preparedPosts.data == nil {
t.preparedPosts.data = &list.List{}
t.preparedPosts.data.Init()
}
// if the postindex is nil, nothing has been indexed yet so there's nothing to prepare
if t.postIndex.data == nil {
return nil
}
var prepared int
var preparing bool
prepareloop:
@ -72,6 +84,17 @@ func (t *timeline) PrepareBefore(statusID string, include bool, amount int) erro
t.Lock()
defer t.Unlock()
// lazily initialize prepared posts if it hasn't been done already
if t.preparedPosts.data == nil {
t.preparedPosts.data = &list.List{}
t.preparedPosts.data.Init()
}
// if the postindex is nil, nothing has been indexed yet so there's nothing to prepare
if t.postIndex.data == nil {
return nil
}
var prepared int
var preparing bool
prepareloop:
@ -116,11 +139,24 @@ func (t *timeline) PrepareFromTop(amount int) error {
t.Lock()
defer t.Unlock()
t.preparedPosts.data.Init()
// lazily initialize prepared posts if it hasn't been done already
if t.preparedPosts.data == nil {
t.preparedPosts.data = &list.List{}
t.preparedPosts.data.Init()
}
// if the postindex is nil, nothing has been indexed yet so there's nothing to prepare
if t.postIndex.data == nil {
return nil
}
var prepared int
prepareloop:
for e := t.postIndex.data.Front(); e != nil; e = e.Next() {
if e == nil {
continue
}
entry, ok := e.Value.(*postIndexEntry)
if !ok {
return errors.New("PrepareFromTop: could not parse e as a postIndexEntry")

View File

@ -45,6 +45,8 @@ var testModels []interface{} = []interface{}{
&gtsmodel.Tag{},
&gtsmodel.User{},
&gtsmodel.Emoji{},
&gtsmodel.Instance{},
&gtsmodel.Notification{},
&oauth.Token{},
&oauth.Client{},
}
@ -129,9 +131,25 @@ func StandardDBSetup(db db.DB) {
}
}
for _, v := range NewTestFollows() {
if err := db.Put(v); err != nil {
panic(err)
}
}
for _, v := range NewTestNotifications() {
if err := db.Put(v); err != nil {
panic(err)
}
}
if err := db.CreateInstanceAccount(); err != nil {
panic(err)
}
if err := db.CreateInstanceInstance(); err != nil {
panic(err)
}
}
// StandardDBTeardown drops all the standard testing tables/models from the database to ensure it's clean for the next test.

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -45,9 +45,9 @@ import (
func NewTestTokens() map[string]*oauth.Token {
tokens := map[string]*oauth.Token{
"local_account_1": {
ID: "64cf4214-33ab-4220-b5ca-4a6a12263b20",
ClientID: "73b48d42-029d-4487-80fc-329a5cf67869",
UserID: "44e36b79-44a4-4bd8-91e9-097f477fe97b",
ID: "01F8MGTQW4DKTDF8SW5CT9HYGA",
ClientID: "01F8MGV8AC3NGSJW0FE8W1BV70",
UserID: "01F8MGVGPHQ2D3P3X0454H54Z5",
RedirectURI: "http://localhost:8080",
Scope: "read write follow push",
Access: "NZAZOTC0OWITMDU0NC0ZODG4LWE4NJITMWUXM2M4MTRHZDEX",
@ -55,9 +55,9 @@ func NewTestTokens() map[string]*oauth.Token {
AccessExpiresAt: time.Now().Add(72 * time.Hour),
},
"local_account_2": {
ID: "b04cae99-39b5-4610-a425-dc6b91c78a72",
ClientID: "a4f6a2ea-a32b-4600-8853-72fc4ad98a1f",
UserID: "d120bd97-866f-4a05-9690-a1294b9934c3",
ID: "01F8MGVVM1EDVYET710J27XY5R",
ClientID: "01F8MGW47HN8ZXNHNZ7E47CDMQ",
UserID: "01F8MGWAPB4GJ42M4N0TCZSQ7K",
RedirectURI: "http://localhost:8080",
Scope: "read write follow push",
Access: "PIPINALKNNNFNF98717NAMNAMNFKIJKJ881818KJKJAKJJJA",
@ -72,22 +72,22 @@ func NewTestTokens() map[string]*oauth.Token {
func NewTestClients() map[string]*oauth.Client {
clients := map[string]*oauth.Client{
"admin_account": {
ID: "1c5cefc8-f0c9-4307-8506-ca6e3888675e",
ID: "01F8MGWSJCND9BWBD4WGJXBM93",
Secret: "dda8e835-2c9c-4bd2-9b8b-77c2e26d7a7a",
Domain: "http://localhost:8080",
UserID: "0fb02eae-2214-473f-9667-0a43f22d75ff", // admin_account
UserID: "01F8MGWYWKVKS3VS8DV1AMYPGE", // admin_account
},
"local_account_1": {
ID: "73b48d42-029d-4487-80fc-329a5cf67869",
ID: "01F8MGV8AC3NGSJW0FE8W1BV70",
Secret: "c3724c74-dc3b-41b2-a108-0ea3d8399830",
Domain: "http://localhost:8080",
UserID: "44e36b79-44a4-4bd8-91e9-097f477fe97b", // local_account_1
UserID: "01F8MGVGPHQ2D3P3X0454H54Z5", // local_account_1
},
"local_account_2": {
ID: "a4f6a2ea-a32b-4600-8853-72fc4ad98a1f",
ID: "01F8MGW47HN8ZXNHNZ7E47CDMQ",
Secret: "8f5603a5-c721-46cd-8f1b-2e368f51379f",
Domain: "http://localhost:8080",
UserID: "d120bd97-866f-4a05-9690-a1294b9934c3", // local_account_2
UserID: "01F8MGWAPB4GJ42M4N0TCZSQ7K", // local_account_2
},
}
return clients
@ -97,31 +97,31 @@ func NewTestClients() map[string]*oauth.Client {
func NewTestApplications() map[string]*gtsmodel.Application {
apps := map[string]*gtsmodel.Application{
"admin_account": {
ID: "9bf9e368-037f-444d-8ffd-1091d1c21c4c",
ID: "01F8MGXQRHYF5QPMTMXP78QC2F",
Name: "superseriousbusiness",
Website: "https://superserious.business",
RedirectURI: "http://localhost:8080",
ClientID: "1c5cefc8-f0c9-4307-8506-ca6e3888675e", // admin client
ClientID: "01F8MGWSJCND9BWBD4WGJXBM93", // admin client
ClientSecret: "dda8e835-2c9c-4bd2-9b8b-77c2e26d7a7a", // admin client
Scopes: "read write follow push",
VapidKey: "76ae0095-8a10-438f-9f49-522d1985b190",
},
"application_1": {
ID: "f88697b8-ee3d-46c2-ac3f-dbb85566c3cc",
ID: "01F8MGY43H3N2C8EWPR2FPYEXG",
Name: "really cool gts application",
Website: "https://reallycool.app",
RedirectURI: "http://localhost:8080",
ClientID: "73b48d42-029d-4487-80fc-329a5cf67869", // client_1
ClientID: "01F8MGV8AC3NGSJW0FE8W1BV70", // client_1
ClientSecret: "c3724c74-dc3b-41b2-a108-0ea3d8399830", // client_1
Scopes: "read write follow push",
VapidKey: "4738dfd7-ca73-4aa6-9aa9-80e946b7db36",
},
"application_2": {
ID: "6b0cd164-8497-4cd5-bec9-957886fac5df",
ID: "01F8MGYG9E893WRHW0TAEXR8GJ",
Name: "kindaweird",
Website: "https://kindaweird.app",
RedirectURI: "http://localhost:8080",
ClientID: "a4f6a2ea-a32b-4600-8853-72fc4ad98a1f", // client_2
ClientID: "01F8MGW47HN8ZXNHNZ7E47CDMQ", // client_2
ClientSecret: "8f5603a5-c721-46cd-8f1b-2e368f51379f", // client_2
Scopes: "read write follow push",
VapidKey: "c040a5fc-e1e2-4859-bbea-0a3efbca1c4b",
@ -134,9 +134,9 @@ func NewTestApplications() map[string]*gtsmodel.Application {
func NewTestUsers() map[string]*gtsmodel.User {
users := map[string]*gtsmodel.User{
"unconfirmed_account": {
ID: "0f7b1d24-1e49-4ee0-bc7e-fd87b7289eea",
ID: "01F8MGYG9E893WRHW0TAEXR8GJ",
Email: "",
AccountID: "59e197f5-87cd-4be8-ac7c-09082ccc4b4d",
AccountID: "01F8MH0BBE4FHXPH513MBVFHB0",
EncryptedPassword: "$2y$10$ggWz5QWwnx6kzb9g0tnIJurFtE0dhr5Zfeaqs9iFuUIXzafQlJVZS", // 'password'
CreatedAt: time.Now(),
SignUpIP: net.ParseIP("199.222.111.89"),
@ -164,9 +164,9 @@ func NewTestUsers() map[string]*gtsmodel.User {
ResetPasswordSentAt: time.Time{},
},
"admin_account": {
ID: "0fb02eae-2214-473f-9667-0a43f22d75ff",
ID: "01F8MGWYWKVKS3VS8DV1AMYPGE",
Email: "admin@example.org",
AccountID: "8020dbb4-1e7b-4d99-a872-4cf94e64210f",
AccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
EncryptedPassword: "$2y$10$ggWz5QWwnx6kzb9g0tnIJurFtE0dhr5Zfeaqs9iFuUIXzafQlJVZS", // 'password'
CreatedAt: time.Now().Add(-72 * time.Hour),
SignUpIP: net.ParseIP("89.22.189.19"),
@ -194,9 +194,9 @@ func NewTestUsers() map[string]*gtsmodel.User {
ResetPasswordSentAt: time.Time{},
},
"local_account_1": {
ID: "44e36b79-44a4-4bd8-91e9-097f477fe97b",
ID: "01F8MGVGPHQ2D3P3X0454H54Z5",
Email: "zork@example.org",
AccountID: "580072df-4d03-4684-a412-89fd6f7d77e6",
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
EncryptedPassword: "$2y$10$ggWz5QWwnx6kzb9g0tnIJurFtE0dhr5Zfeaqs9iFuUIXzafQlJVZS", // 'password'
CreatedAt: time.Now().Add(-36 * time.Hour),
SignUpIP: net.ParseIP("59.99.19.172"),
@ -210,7 +210,7 @@ func NewTestUsers() map[string]*gtsmodel.User {
ChosenLanguages: []string{"en"},
FilteredLanguages: []string{},
Locale: "en",
CreatedByApplicationID: "f88697b8-ee3d-46c2-ac3f-dbb85566c3cc",
CreatedByApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG",
LastEmailedAt: time.Now().Add(-55 * time.Minute),
ConfirmationToken: "",
ConfirmedAt: time.Now().Add(-34 * time.Hour),
@ -224,9 +224,9 @@ func NewTestUsers() map[string]*gtsmodel.User {
ResetPasswordSentAt: time.Time{},
},
"local_account_2": {
ID: "f8d6272e-2d71-4d0c-97d3-2ba7a0b75bf7",
ID: "01F8MH1VYJAE00TVVGMM5JNJ8X",
Email: "tortle.dude@example.org",
AccountID: "eecaad73-5703-426d-9312-276641daa31e",
AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
EncryptedPassword: "$2y$10$ggWz5QWwnx6kzb9g0tnIJurFtE0dhr5Zfeaqs9iFuUIXzafQlJVZS", // 'password'
CreatedAt: time.Now().Add(-36 * time.Hour),
SignUpIP: net.ParseIP("59.99.19.172"),
@ -262,11 +262,11 @@ func NewTestUsers() map[string]*gtsmodel.User {
func NewTestAccounts() map[string]*gtsmodel.Account {
accounts := map[string]*gtsmodel.Account{
"instance_account": {
ID: "39b745a3-774d-4b65-8bb2-b63d9e20a343",
ID: "01F8MH261H1KSV3GW3016GZRY3",
Username: "localhost:8080",
},
"unconfirmed_account": {
ID: "59e197f5-87cd-4be8-ac7c-09082ccc4b4d",
ID: "01F8MH0BBE4FHXPH513MBVFHB0",
Username: "weed_lord420",
AvatarMediaAttachmentID: "",
HeaderMediaAttachmentID: "",
@ -304,7 +304,7 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
SuspensionOrigin: "",
},
"admin_account": {
ID: "8020dbb4-1e7b-4d99-a872-4cf94e64210f",
ID: "01F8MH17FWEB39HZJ76B6VXSKF",
Username: "admin",
AvatarMediaAttachmentID: "",
HeaderMediaAttachmentID: "",
@ -342,10 +342,10 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
SuspensionOrigin: "",
},
"local_account_1": {
ID: "580072df-4d03-4684-a412-89fd6f7d77e6",
ID: "01F8MH1H7YV1Z7D2C8K2730QBF",
Username: "the_mighty_zork",
AvatarMediaAttachmentID: "a849906f-8b8e-4b43-ac2f-6979ccbcd442",
HeaderMediaAttachmentID: "",
AvatarMediaAttachmentID: "01F8MH58A357CV5K7R7TJMSH6S",
HeaderMediaAttachmentID: "01PFPMWK2FF0D9WMHEJHR07C3Q",
DisplayName: "original zork (he/they)",
Fields: []gtsmodel.Field{},
Note: "hey yo this is my profile!",
@ -380,7 +380,7 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
SuspensionOrigin: "",
},
"local_account_2": {
ID: "eecaad73-5703-426d-9312-276641daa31e",
ID: "01F8MH5NBDF2MV7CTC4Q5128HF",
Username: "1happyturtle",
AvatarMediaAttachmentID: "",
HeaderMediaAttachmentID: "",
@ -418,19 +418,9 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
SuspensionOrigin: "",
},
"remote_account_1": {
ID: "c2c6e647-e2a9-4286-883b-e4a188186664",
Username: "foss_satan",
Domain: "fossbros-anonymous.io",
// 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: "",
ID: "01F8MH5ZK5VRH73AKHQM6Y9VNX",
Username: "foss_satan",
Domain: "fossbros-anonymous.io",
DisplayName: "big gerald",
Fields: []gtsmodel.Field{},
Note: "i post about like, i dunno, stuff, or whatever!!!!",
@ -462,20 +452,6 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
HideCollections: false,
SuspensionOrigin: "",
},
// "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",
// },
}
// generate keys for each account
@ -500,9 +476,9 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
return map[string]*gtsmodel.MediaAttachment{
"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",
ID: "01F8MH6NEM8D7527KZAECTCR76",
StatusID: "01F8MH75CBF9JFX4ZAD54N0W0R",
URL: "http://localhost:8080/fileserver/01F8MH17FWEB39HZJ76B6VXSKF/attachment/original/01F8MH6NEM8D7527KZAECTCR76.jpeg",
RemoteURL: "",
CreatedAt: time.Now().Add(-71 * time.Hour),
UpdatedAt: time.Now().Add(-71 * time.Hour),
@ -521,32 +497,32 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
Aspect: 1.9104477611940298,
},
},
AccountID: "8020dbb4-1e7b-4d99-a872-4cf94e64210f",
AccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
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",
Path: "/gotosocial/storage/01F8MH17FWEB39HZJ76B6VXSKF/attachment/original/01F8MH6NEM8D7527KZAECTCR76.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",
Path: "/gotosocial/storage/01F8MH17FWEB39HZJ76B6VXSKF/attachment/small/01F8MH6NEM8D7527KZAECTCR76.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",
URL: "http://localhost:8080/fileserver/01F8MH17FWEB39HZJ76B6VXSKF/attachment/small/01F8MH6NEM8D7527KZAECTCR76.jpeg",
RemoteURL: "",
},
Avatar: false,
Header: false,
},
"local_account_1_status_4_attachment_1": {
ID: "510f6033-798b-4390-81b1-c38ca2205ad3",
StatusID: "18524c05-97dc-46d7-b474-c811bd9e1e32",
URL: "http://localhost:8080/fileserver/580072df-4d03-4684-a412-89fd6f7d77e6/attachment/original/510f6033-798b-4390-81b1-c38ca2205ad3.gif",
ID: "01F8MH7TDVANYKWVE8VVKFPJTJ",
StatusID: "01F8MH82FYRXD2RC6108DAJ5HB",
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/original/01F8MH7TDVANYKWVE8VVKFPJTJ.gif",
RemoteURL: "",
CreatedAt: time.Now().Add(-1 * time.Hour),
UpdatedAt: time.Now().Add(-1 * time.Hour),
@ -569,32 +545,32 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
Y: 0,
},
},
AccountID: "580072df-4d03-4684-a412-89fd6f7d77e6",
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
Description: "90's Trent Reznor turning to the camera",
ScheduledStatusID: "",
Blurhash: "LEDara58O=t5EMSOENEN9]}?aK%0",
Processing: 2,
File: gtsmodel.File{
Path: "/gotosocial/storage/580072df-4d03-4684-a412-89fd6f7d77e6/attachment/original/510f6033-798b-4390-81b1-c38ca2205ad3.gif",
Path: "/gotosocial/storage/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/original/01F8MH7TDVANYKWVE8VVKFPJTJ.gif",
ContentType: "image/gif",
FileSize: 1109138,
UpdatedAt: time.Now().Add(-1 * time.Hour),
},
Thumbnail: gtsmodel.Thumbnail{
Path: "/gotosocial/storage/580072df-4d03-4684-a412-89fd6f7d77e6/attachment/small/510f6033-798b-4390-81b1-c38ca2205ad3.jpeg",
Path: "/gotosocial/storage/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/small/01F8MH7TDVANYKWVE8VVKFPJTJ.jpeg",
ContentType: "image/jpeg",
FileSize: 8803,
UpdatedAt: time.Now().Add(-1 * time.Hour),
URL: "http://localhost:8080/fileserver/580072df-4d03-4684-a412-89fd6f7d77e6/attachment/small/510f6033-798b-4390-81b1-c38ca2205ad3.jpeg",
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/small/01F8MH7TDVANYKWVE8VVKFPJTJ.jpeg",
RemoteURL: "",
},
Avatar: false,
Header: false,
},
"local_account_1_unattached_1": {
ID: "7a3b9f77-ab30-461e-bdd8-e64bd1db3008",
ID: "01F8MH8RMYQ6MSNY3JM2XT1CQ5",
StatusID: "", // this attachment isn't connected to a status YET
URL: "http://localhost:8080/fileserver/580072df-4d03-4684-a412-89fd6f7d77e6/attachment/original/7a3b9f77-ab30-461e-bdd8-e64bd1db3008.jpeg",
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/original/01F8MH8RMYQ6MSNY3JM2XT1CQ5.jpeg",
RemoteURL: "",
CreatedAt: time.Now().Add(30 * time.Second),
UpdatedAt: time.Now().Add(30 * time.Second),
@ -617,35 +593,35 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
Y: 0,
},
},
AccountID: "580072df-4d03-4684-a412-89fd6f7d77e6",
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
Description: "the oh you meme",
ScheduledStatusID: "",
Blurhash: "LSAd]9ogDge-R:M|j=xWIto0xXWX",
Processing: 2,
File: gtsmodel.File{
Path: "/gotosocial/storage/580072df-4d03-4684-a412-89fd6f7d77e6/attachment/original/7a3b9f77-ab30-461e-bdd8-e64bd1db3008.jpeg",
Path: "/gotosocial/storage/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/original/01F8MH8RMYQ6MSNY3JM2XT1CQ5.jpeg",
ContentType: "image/jpeg",
FileSize: 27759,
UpdatedAt: time.Now().Add(30 * time.Second),
},
Thumbnail: gtsmodel.Thumbnail{
Path: "/gotosocial/storage/580072df-4d03-4684-a412-89fd6f7d77e6/attachment/small/7a3b9f77-ab30-461e-bdd8-e64bd1db3008.jpeg",
Path: "/gotosocial/storage/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/small/01F8MH8RMYQ6MSNY3JM2XT1CQ5.jpeg",
ContentType: "image/jpeg",
FileSize: 6177,
UpdatedAt: time.Now().Add(30 * time.Second),
URL: "http://localhost:8080/fileserver/580072df-4d03-4684-a412-89fd6f7d77e6/attachment/small/7a3b9f77-ab30-461e-bdd8-e64bd1db3008.jpeg",
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/attachment/small/01F8MH8RMYQ6MSNY3JM2XT1CQ5.jpeg",
RemoteURL: "",
},
Avatar: false,
Header: false,
},
"local_account_1_avatar": {
ID: "a849906f-8b8e-4b43-ac2f-6979ccbcd442",
ID: "01F8MH58A357CV5K7R7TJMSH6S",
StatusID: "", // this attachment isn't connected to a status
URL: "http://localhost:8080/fileserver/580072df-4d03-4684-a412-89fd6f7d77e6/avatar/original/a849906f-8b8e-4b43-ac2f-6979ccbcd442.jpeg",
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpeg",
RemoteURL: "",
CreatedAt: time.Now().Add(47 * time.Hour),
UpdatedAt: time.Now().Add(47 * time.Hour),
CreatedAt: time.Now().Add(-47 * time.Hour),
UpdatedAt: time.Now().Add(-47 * time.Hour),
Type: gtsmodel.FileTypeImage,
FileMeta: gtsmodel.FileMeta{
Original: gtsmodel.Original{
@ -665,28 +641,76 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
Y: 0,
},
},
AccountID: "580072df-4d03-4684-a412-89fd6f7d77e6",
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
Description: "a green goblin looking nasty",
ScheduledStatusID: "",
Blurhash: "LKK9MT,p|YSNDkJ-5rsmvnwcOoe:",
Processing: 2,
File: gtsmodel.File{
Path: "/gotosocial/storage/580072df-4d03-4684-a412-89fd6f7d77e6/avatar/original/a849906f-8b8e-4b43-ac2f-6979ccbcd442.jpeg",
Path: "/gotosocial/storage/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpeg",
ContentType: "image/jpeg",
FileSize: 457680,
UpdatedAt: time.Now().Add(47 * time.Hour),
UpdatedAt: time.Now().Add(-47 * time.Hour),
},
Thumbnail: gtsmodel.Thumbnail{
Path: "/gotosocial/storage/580072df-4d03-4684-a412-89fd6f7d77e6/avatar/small/a849906f-8b8e-4b43-ac2f-6979ccbcd442.jpeg",
Path: "/gotosocial/storage/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.jpeg",
ContentType: "image/jpeg",
FileSize: 15374,
UpdatedAt: time.Now().Add(47 * time.Hour),
URL: "http://localhost:8080/fileserver/580072df-4d03-4684-a412-89fd6f7d77e6/avatar/small/a849906f-8b8e-4b43-ac2f-6979ccbcd442.jpeg",
UpdatedAt: time.Now().Add(-47 * time.Hour),
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.jpeg",
RemoteURL: "",
},
Avatar: true,
Header: false,
},
"local_account_1_header": {
ID: "01PFPMWK2FF0D9WMHEJHR07C3Q",
StatusID: "",
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpeg",
RemoteURL: "",
CreatedAt: time.Now().Add(-47 * time.Hour),
UpdatedAt: time.Now().Add(-47 * time.Hour),
Type: gtsmodel.FileTypeImage,
FileMeta: gtsmodel.FileMeta{
Original: gtsmodel.Original{
Width: 1018,
Height: 764,
Size: 777752,
Aspect: 1.3324607329842932,
},
Small: gtsmodel.Small{
Width: 256,
Height: 192,
Size: 49152,
Aspect: 1.3333333333333333,
},
Focus: gtsmodel.Focus{
X: 0,
Y: 0,
},
},
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
Description: "A very old-school screenshot of the original team fortress mod for quake ",
ScheduledStatusID: "",
Blurhash: "L26j{^WCs+R-N}jsxWj@4;WWxDoK",
Processing: 2,
File: gtsmodel.File{
Path: "/gotosocial/storage/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpeg",
ContentType: "image/jpeg",
FileSize: 517226,
UpdatedAt: time.Now().Add(-47 * time.Hour),
},
Thumbnail: gtsmodel.Thumbnail{
Path: "/gotosocial/storage/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.jpeg",
ContentType: "image/jpeg",
FileSize: 42308,
UpdatedAt: time.Now().Add(-47 * time.Hour),
URL: "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.jpeg",
RemoteURL: "",
},
Avatar: false,
Header: true,
},
}
}
@ -694,24 +718,24 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
func NewTestEmojis() map[string]*gtsmodel.Emoji {
return map[string]*gtsmodel.Emoji{
"rainbow": {
ID: "a96ec4f3-1cae-47e4-a508-f9d66a6b221b",
ID: "01F8MH9H8E4VG3KDYJR9EGPXCQ",
Shortcode: "rainbow",
Domain: "",
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
ImageRemoteURL: "",
ImageStaticRemoteURL: "",
ImageURL: "http://localhost:8080/fileserver/39b745a3-774d-4b65-8bb2-b63d9e20a343/emoji/original/a96ec4f3-1cae-47e4-a508-f9d66a6b221b.png",
ImagePath: "/tmp/gotosocial/39b745a3-774d-4b65-8bb2-b63d9e20a343/emoji/original/a96ec4f3-1cae-47e4-a508-f9d66a6b221b.png",
ImageStaticURL: "http://localhost:8080/fileserver/39b745a3-774d-4b65-8bb2-b63d9e20a343/emoji/static/a96ec4f3-1cae-47e4-a508-f9d66a6b221b.png",
ImageStaticPath: "/tmp/gotosocial/39b745a3-774d-4b65-8bb2-b63d9e20a343/emoji/static/a96ec4f3-1cae-47e4-a508-f9d66a6b221b.png",
ImageURL: "http://localhost:8080/fileserver/01F8MH261H1KSV3GW3016GZRY3/emoji/original/01F8MH9H8E4VG3KDYJR9EGPXCQ.png",
ImagePath: "/tmp/gotosocial/01F8MH261H1KSV3GW3016GZRY3/emoji/original/01F8MH9H8E4VG3KDYJR9EGPXCQ.png",
ImageStaticURL: "http://localhost:8080/fileserver/01F8MH261H1KSV3GW3016GZRY3/emoji/static/01F8MH9H8E4VG3KDYJR9EGPXCQ.png",
ImageStaticPath: "/tmp/gotosocial/01F8MH261H1KSV3GW3016GZRY3/emoji/static/01F8MH9H8E4VG3KDYJR9EGPXCQ.png",
ImageContentType: "image/png",
ImageStaticContentType: "image/png",
ImageFileSize: 36702,
ImageStaticFileSize: 10413,
ImageUpdatedAt: time.Now(),
Disabled: false,
URI: "http://localhost:8080/emoji/a96ec4f3-1cae-47e4-a508-f9d66a6b221b",
URI: "http://localhost:8080/emoji/01F8MH9H8E4VG3KDYJR9EGPXCQ",
VisibleInPicker: true,
CategoryID: "",
},
@ -743,6 +767,10 @@ func newTestStoredAttachments() map[string]filenames {
Original: "zork-original.jpeg",
Small: "zork-small.jpeg",
},
"local_account_1_header": {
Original: "team-fortress-original.jpeg",
Small: "team-fortress-small.jpeg",
},
}
}
@ -761,25 +789,25 @@ func newTestStoredEmoji() map[string]filenames {
func NewTestStatuses() map[string]*gtsmodel.Status {
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",
ID: "01F8MH75CBF9JFX4ZAD54N0W0R",
URI: "http://localhost:8080/users/admin/statuses/01F8MH75CBF9JFX4ZAD54N0W0R",
URL: "http://localhost:8080/@admin/statuses/01F8MH75CBF9JFX4ZAD54N0W0R",
Content: "hello world! #welcome ! first post on the instance :rainbow: !",
Attachments: []string{"b052241b-f30f-4dc6-92fc-2bad0be1f8d8"},
Tags: []string{"a7e8f5ca-88a1-4652-8079-a187eab8d56e"},
Attachments: []string{"01F8MH6NEM8D7527KZAECTCR76"},
Tags: []string{"01F8MHA1A2NF9MJ3WCCQ3K8BSZ"},
Mentions: []string{},
Emojis: []string{"a96ec4f3-1cae-47e4-a508-f9d66a6b221b"},
Emojis: []string{"01F8MH9H8E4VG3KDYJR9EGPXCQ"},
CreatedAt: time.Now().Add(-71 * time.Hour),
UpdatedAt: time.Now().Add(-71 * time.Hour),
Local: true,
AccountID: "8020dbb4-1e7b-4d99-a872-4cf94e64210f",
AccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: false,
Language: "en",
CreatedWithApplicationID: "9bf9e368-037f-444d-8ffd-1091d1c21c4c",
CreatedWithApplicationID: "01F8MGXQRHYF5QPMTMXP78QC2F",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: true,
@ -789,21 +817,21 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
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",
ID: "01F8MHAAY43M6RJ473VQFCVH37",
URI: "http://localhost:8080/users/admin/statuses/01F8MHAAY43M6RJ473VQFCVH37",
URL: "http://localhost:8080/@admin/statuses/01F8MHAAY43M6RJ473VQFCVH37",
Content: "🐕🐕🐕🐕🐕",
CreatedAt: time.Now().Add(-70 * time.Hour),
UpdatedAt: time.Now().Add(-70 * time.Hour),
Local: true,
AccountID: "8020dbb4-1e7b-4d99-a872-4cf94e64210f",
AccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "open to see some puppies",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: true,
Language: "en",
CreatedWithApplicationID: "9bf9e368-037f-444d-8ffd-1091d1c21c4c",
CreatedWithApplicationID: "01F8MGXQRHYF5QPMTMXP78QC2F",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: true,
@ -813,21 +841,21 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
},
"local_account_1_status_1": {
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",
ID: "01F8MHAMCHF6Y650WCRSCP4WMY",
URI: "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY",
URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY",
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",
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "introduction post",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: true,
Language: "en",
CreatedWithApplicationID: "f88697b8-ee3d-46c2-ac3f-dbb85566c3cc",
CreatedWithApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: true,
@ -837,21 +865,21 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
},
"local_account_1_status_2": {
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",
ID: "01F8MHAYFKS4KMXF8K5Y1C0KRN",
URI: "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAYFKS4KMXF8K5Y1C0KRN",
URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MHAYFKS4KMXF8K5Y1C0KRN",
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",
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "",
Visibility: gtsmodel.VisibilityUnlocked,
Sensitive: false,
Language: "en",
CreatedWithApplicationID: "f88697b8-ee3d-46c2-ac3f-dbb85566c3cc",
CreatedWithApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: false,
Boostable: true,
@ -861,21 +889,21 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
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",
ID: "01F8MHBBN8120SYH7D5S050MGK",
URI: "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHBBN8120SYH7D5S050MGK",
URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MHBBN8120SYH7D5S050MGK",
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",
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "test: you shouldn't be able to interact with this post in any way",
Visibility: gtsmodel.VisibilityMutualsOnly,
Sensitive: false,
Language: "en",
CreatedWithApplicationID: "f88697b8-ee3d-46c2-ac3f-dbb85566c3cc",
CreatedWithApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: false,
@ -885,22 +913,22 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
},
"local_account_1_status_4": {
ID: "18524c05-97dc-46d7-b474-c811bd9e1e32",
URI: "http://localhost:8080/users/the_mighty_zork/statuses/18524c05-97dc-46d7-b474-c811bd9e1e32",
URL: "http://localhost:8080/@the_mighty_zork/statuses/18524c05-97dc-46d7-b474-c811bd9e1e32",
ID: "01F8MH82FYRXD2RC6108DAJ5HB",
URI: "http://localhost:8080/users/the_mighty_zork/statuses/01F8MH82FYRXD2RC6108DAJ5HB",
URL: "http://localhost:8080/@the_mighty_zork/statuses/01F8MH82FYRXD2RC6108DAJ5HB",
Content: "here's a little gif of trent",
Attachments: []string{"510f6033-798b-4390-81b1-c38ca2205ad3"},
Attachments: []string{"01F8MH7TDVANYKWVE8VVKFPJTJ"},
CreatedAt: time.Now().Add(-1 * time.Hour),
UpdatedAt: time.Now().Add(-1 * time.Hour),
Local: true,
AccountID: "580072df-4d03-4684-a412-89fd6f7d77e6",
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "eye contact, trent reznor gif",
Visibility: gtsmodel.VisibilityMutualsOnly,
Sensitive: false,
Language: "en",
CreatedWithApplicationID: "f88697b8-ee3d-46c2-ac3f-dbb85566c3cc",
CreatedWithApplicationID: "01F8MGY43H3N2C8EWPR2FPYEXG",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: true,
@ -910,21 +938,21 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
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",
ID: "01F8MHBQCBTDKN6X5VHGMMN4MA",
URI: "http://localhost:8080/users/1happyturtle/statuses/01F8MHBQCBTDKN6X5VHGMMN4MA",
URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHBQCBTDKN6X5VHGMMN4MA",
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",
AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "introduction post",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: true,
Language: "en",
CreatedWithApplicationID: "6b0cd164-8497-4cd5-bec9-957886fac5df",
CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: true,
@ -934,21 +962,21 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
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",
ID: "01F8MHC0H0A7XHTVH5F596ZKBM",
URI: "http://localhost:8080/users/1happyturtle/statuses/01F8MHC0H0A7XHTVH5F596ZKBM",
URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHC0H0A7XHTVH5F596ZKBM",
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",
AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: true,
Language: "en",
CreatedWithApplicationID: "6b0cd164-8497-4cd5-bec9-957886fac5df",
CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: true,
@ -958,21 +986,21 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
},
"local_account_2_status_3": {
ID: "75960e30-7a8e-4f45-87fa-440a4d1c9572",
URI: "http://localhost:8080/users/1happyturtle/statuses/75960e30-7a8e-4f45-87fa-440a4d1c9572",
URL: "http://localhost:8080/@1happyturtle/statuses/75960e30-7a8e-4f45-87fa-440a4d1c9572",
ID: "01F8MHC8VWDRBQR0N1BATDDEM5",
URI: "http://localhost:8080/users/1happyturtle/statuses/01F8MHC8VWDRBQR0N1BATDDEM5",
URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHC8VWDRBQR0N1BATDDEM5",
Content: "🐢 i don't mind people sharing this one but I don't want likes or replies to it because cba🐢",
CreatedAt: time.Now().Add(-2 * time.Minute),
UpdatedAt: time.Now().Add(-2 * time.Minute),
Local: true,
AccountID: "eecaad73-5703-426d-9312-276641daa31e",
AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "you won't be able to like or reply to this",
Visibility: gtsmodel.VisibilityUnlocked,
Sensitive: true,
Language: "en",
CreatedWithApplicationID: "6b0cd164-8497-4cd5-bec9-957886fac5df",
CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: true,
Boostable: true,
@ -982,21 +1010,21 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
ActivityStreamsType: gtsmodel.ActivityStreamsNote,
},
"local_account_2_status_4": {
ID: "57e41a35-20da-4bc9-9cfd-db2089f924db",
URI: "http://localhost:8080/users/1happyturtle/statuses/57e41a35-20da-4bc9-9cfd-db2089f924db",
URL: "http://localhost:8080/@1happyturtle/statuses/57e41a35-20da-4bc9-9cfd-db2089f924db",
ID: "01F8MHCP5P2NWYQ416SBA0XSEV",
URI: "http://localhost:8080/users/1happyturtle/statuses/01F8MHCP5P2NWYQ416SBA0XSEV",
URL: "http://localhost:8080/@1happyturtle/statuses/01F8MHCP5P2NWYQ416SBA0XSEV",
Content: "🐢 this is a public status but I want it local only and not boostable 🐢",
CreatedAt: time.Now().Add(-1 * time.Minute),
UpdatedAt: time.Now().Add(-1 * time.Minute),
Local: true,
AccountID: "eecaad73-5703-426d-9312-276641daa31e",
AccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
InReplyToID: "",
BoostOfID: "",
ContentWarning: "",
Visibility: gtsmodel.VisibilityPublic,
Sensitive: true,
Language: "en",
CreatedWithApplicationID: "6b0cd164-8497-4cd5-bec9-957886fac5df",
CreatedWithApplicationID: "01F8MGYG9E893WRHW0TAEXR8GJ",
VisibilityAdvanced: &gtsmodel.VisibilityAdvanced{
Federated: false,
Boostable: false,
@ -1012,7 +1040,7 @@ func NewTestStatuses() map[string]*gtsmodel.Status {
func NewTestTags() map[string]*gtsmodel.Tag {
return map[string]*gtsmodel.Tag{
"welcome": {
ID: "a7e8f5ca-88a1-4652-8079-a187eab8d56e",
ID: "01F8MHA1A2NF9MJ3WCCQ3K8BSZ",
Name: "welcome",
FirstSeenFromAccountID: "",
CreatedAt: time.Now().Add(-71 * time.Hour),
@ -1028,11 +1056,61 @@ func NewTestTags() map[string]*gtsmodel.Tag {
func NewTestFaves() map[string]*gtsmodel.StatusFave {
return map[string]*gtsmodel.StatusFave{
"local_account_1_admin_account_status_1": {
ID: "fc4d42ef-631c-4125-bd9d-88695131284c",
ID: "01F8MHD2QCZSZ6WQS2ATVPEYJ9",
CreatedAt: time.Now().Add(-47 * time.Hour),
AccountID: "580072df-4d03-4684-a412-89fd6f7d77e6", // local account 1
TargetAccountID: "8020dbb4-1e7b-4d99-a872-4cf94e64210f", // admin account
StatusID: "502ccd6f-0edf-48d7-9016-2dfa4d3714cd", // admin account status 1
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", // local account 1
TargetAccountID: "01F8MH17FWEB39HZJ76B6VXSKF", // admin account
StatusID: "01F8MH75CBF9JFX4ZAD54N0W0R", // admin account status 1
URI: "http://localhost:8080/users/the_mighty_zork/liked/01F8MHD2QCZSZ6WQS2ATVPEYJ9",
},
"admin_account_local_account_1_status_1": {
ID: "01F8Q0486ANTDWKG02A7DS1Q24",
CreatedAt: time.Now().Add(-46 * time.Hour),
AccountID: "01F8MH17FWEB39HZJ76B6VXSKF", // admin account
TargetAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF", // local account 1
StatusID: "01F8MHAMCHF6Y650WCRSCP4WMY", // local account status 1
URI: "http://localhost:8080/users/admin/liked/01F8Q0486ANTDWKG02A7DS1Q24",
},
}
}
// NewTestNotifications returns some notifications for use in testing.
func NewTestNotifications() map[string]*gtsmodel.Notification {
return map[string]*gtsmodel.Notification{
"local_account_1_like": {
ID: "01F8Q0ANPTWW10DAKTX7BRPBJP",
NotificationType: gtsmodel.NotificationFave,
CreatedAt: time.Now().Add(-46 * time.Hour),
TargetAccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
OriginAccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
StatusID: "01F8MHAMCHF6Y650WCRSCP4WMY",
Read: false,
},
}
}
// NewTestFollows returns some follows for use in testing.
func NewTestFollows() map[string]*gtsmodel.Follow {
return map[string]*gtsmodel.Follow{
"local_account_1_admin_account": {
ID: "01F8PY8RHWRQZV038T4E8T9YK8",
CreatedAt: time.Now().Add(-46 * time.Hour),
UpdatedAt: time.Now().Add(-46 * time.Hour),
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
TargetAccountID: "01F8MH17FWEB39HZJ76B6VXSKF",
ShowReblogs: true,
URI: "http://localhost:8080/users/the_mighty_zork/follow/01F8PY8RHWRQZV038T4E8T9YK8",
Notify: false,
},
"local_account_1_local_account_2": {
ID: "01F8PYDCE8XE23GRE5DPZJDZDP",
CreatedAt: time.Now().Add(-1 * time.Hour),
UpdatedAt: time.Now().Add(-1 * time.Hour),
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
TargetAccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
ShowReblogs: true,
URI: "http://localhost:8080/users/the_mighty_zork/follow/01F8PYDCE8XE23GRE5DPZJDZDP",
Notify: false,
},
}
}