tests for status create

This commit is contained in:
tsmethurst
2021-04-06 16:31:57 +02:00
parent 21ffcd98ec
commit 1025ac31aa
10 changed files with 571 additions and 57 deletions

View File

@ -30,6 +30,37 @@ func StandardDBSetup(db db.DB) error {
return err
}
}
for _, v := range TestTokens() {
if err := db.Put(v); err != nil {
return err
}
}
for _, v := range TestClients() {
if err := db.Put(v); err != nil {
return err
}
}
for _, v := range TestApplications() {
if err := db.Put(v); err != nil {
return err
}
}
for _, v := range TestUsers() {
if err := db.Put(v); err != nil {
return err
}
}
for _, v := range TestAccounts() {
if err := db.Put(v); err != nil {
return err
}
}
return nil
}

View File

@ -13,7 +13,14 @@ import (
func TestTokens() 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",
RedirectURI: "http://localhost:8080",
Scope: "read write follow push",
Access: "NZAZOTC0OWITMDU0NC0ZODG4LWE4NJITMWUXM2M4MTRHZDEX",
AccessCreateAt: time.Now(),
AccessExpiresAt: time.Now().Add(72 * time.Hour),
},
}
return tokens
@ -126,7 +133,7 @@ func TestUsers() map[string]*model.User {
ChosenLanguages: []string{"en"},
FilteredLanguages: []string{},
Locale: "en",
CreatedByApplicationID: "",
CreatedByApplicationID: "f88697b8-ee3d-46c2-ac3f-dbb85566c3cc",
LastEmailedAt: time.Now().Add(-55 * time.Minute),
ConfirmationToken: "",
ConfirmedAt: time.Now().Add(-34 * time.Hour),
@ -203,14 +210,14 @@ func TestAccounts() map[string]*model.Account {
Privacy: model.VisibilityPublic,
Sensitive: false,
Language: "en",
URI: "http://localhost:8080/users/admin",
URL: "http://localhost:8080/@admin",
URI: "http://localhost:8080/users/weed_lord420",
URL: "http://localhost:8080/@weed_lord420",
LastWebfingeredAt: time.Time{},
InboxURL: "http://localhost:8080/users/admin/inbox",
OutboxURL: "http://localhost:8080/users/admin/outbox",
InboxURL: "http://localhost:8080/users/weed_lord420/inbox",
OutboxURL: "http://localhost:8080/users/weed_lord420/outbox",
SharedInboxURL: "",
FollowersURL: "http://localhost:8080/users/admin/followers",
FeaturedCollectionURL: "http://localhost:8080/users/admin/collections/featured",
FollowersURL: "http://localhost:8080/users/weed_lord420/followers",
FeaturedCollectionURL: "http://localhost:8080/users/weed_lord420/collections/featured",
ActorType: model.ActivityStreamsPerson,
AlsoKnownAs: "",
PrivateKey: &rsa.PrivateKey{},
@ -360,21 +367,61 @@ func TestAccounts() map[string]*model.Account {
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: "",
DisplayName: "big gerald",
Fields: []model.Field{},
Note: "",
Memorial: false,
MovedToAccountID: "",
CreatedAt: time.Now().Add(-190 * time.Hour),
UpdatedAt: time.Now().Add(-36 * time.Hour),
Bot: false,
Reason: "",
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",
ActorType: model.ActivityStreamsPerson,
AlsoKnownAs: "",
PrivateKey: &rsa.PrivateKey{},
PublicKey: nil,
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
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",
},
// "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