summaryrefslogtreecommitdiff
path: root/testrig/db.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-11-08 14:32:17 +0000
committerLibravatar GitHub <noreply@github.com>2023-11-08 14:32:17 +0000
commite9e5dc5a40926e5320cb131b035c46b1e1b0bd59 (patch)
tree52edc9fa5742f28e1e5223f51cda628ec1c35a24 /testrig/db.go
parent[chore]: Bump github.com/spf13/cobra from 1.7.0 to 1.8.0 (#2338) (diff)
downloadgotosocial-e9e5dc5a40926e5320cb131b035c46b1e1b0bd59.tar.xz
[feature] add support for polls + receiving federated status edits (#2330)
Diffstat (limited to 'testrig/db.go')
-rw-r--r--testrig/db.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/testrig/db.go b/testrig/db.go
index 771345fe1..17c8f83b0 100644
--- a/testrig/db.go
+++ b/testrig/db.go
@@ -44,6 +44,8 @@ var testModels = []interface{}{
&gtsmodel.Marker{},
&gtsmodel.MediaAttachment{},
&gtsmodel.Mention{},
+ &gtsmodel.Poll{},
+ &gtsmodel.PollVote{},
&gtsmodel.Status{},
&gtsmodel.StatusToEmoji{},
&gtsmodel.StatusToTag{},
@@ -315,6 +317,18 @@ func StandardDBSetup(db db.DB, accounts map[string]*gtsmodel.Account) {
}
}
+ for _, v := range NewTestPolls() {
+ if err := db.Put(ctx, v); err != nil {
+ log.Panic(nil, err)
+ }
+ }
+
+ for _, v := range NewTestPollVotes() {
+ if err := db.Put(ctx, v); err != nil {
+ log.Panic(nil, err)
+ }
+ }
+
if err := db.CreateInstanceAccount(ctx); err != nil {
log.Panic(nil, err)
}
@@ -330,7 +344,7 @@ func StandardDBSetup(db db.DB, accounts map[string]*gtsmodel.Account) {
func StandardDBTeardown(db db.DB) {
ctx := context.Background()
if db == nil {
- log.Panic(nil, "db was nil")
+ return
}
for _, m := range testModels {
if err := db.DropTable(ctx, m); err != nil {