summaryrefslogtreecommitdiff
path: root/testrig
diff options
context:
space:
mode:
Diffstat (limited to 'testrig')
-rw-r--r--testrig/db.go7
-rw-r--r--testrig/testmodels.go31
2 files changed, 38 insertions, 0 deletions
diff --git a/testrig/db.go b/testrig/db.go
index 4d8dfefa5..57e94a4bf 100644
--- a/testrig/db.go
+++ b/testrig/db.go
@@ -61,6 +61,7 @@ var testModels = []interface{}{
&gtsmodel.EmojiCategory{},
&gtsmodel.Tombstone{},
&gtsmodel.Report{},
+ &gtsmodel.Rule{},
&gtsmodel.AccountNote{},
}
@@ -160,6 +161,12 @@ func StandardDBSetup(db db.DB, accounts map[string]*gtsmodel.Account) {
}
}
+ for _, v := range NewTestRules() {
+ if err := db.Put(ctx, v); err != nil {
+ log.Panic(nil, err)
+ }
+ }
+
for _, v := range NewTestDomainBlocks() {
if err := db.Put(ctx, v); err != nil {
log.Panic(nil, err)
diff --git a/testrig/testmodels.go b/testrig/testmodels.go
index f5f63f6fa..4f0768b45 100644
--- a/testrig/testmodels.go
+++ b/testrig/testmodels.go
@@ -2021,6 +2021,7 @@ func NewTestReports() map[string]*gtsmodel.Report {
Comment: "dark souls sucks, please yeet this nerd",
StatusIDs: []string{"01FVW7JHQFSFK166WWKR8CBA6M"},
Forwarded: util.Ptr(true),
+ RuleIDs: []string{"01GP3AWY4CRDVRNZKW0TEAMB51", "01GP3DFY9XQ1TJMZT5BGAZPXX3"},
},
"remote_account_1_report_local_account_2": {
ID: "01GP3DFY9XQ1TJMZT5BGAZPXX7",
@@ -2031,6 +2032,7 @@ func NewTestReports() map[string]*gtsmodel.Report {
TargetAccountID: "01F8MH5NBDF2MV7CTC4Q5128HF",
Comment: "this is a turtle, not a person, therefore should not be a poster",
StatusIDs: []string{},
+ RuleIDs: []string{},
Forwarded: util.Ptr(true),
ActionTaken: "user was warned not to be a turtle anymore",
ActionTakenAt: TimeMustParse("2022-05-15T17:01:56+02:00"),
@@ -2039,6 +2041,35 @@ func NewTestReports() map[string]*gtsmodel.Report {
}
}
+func NewTestRules() map[string]*gtsmodel.Rule {
+ return map[string]*gtsmodel.Rule{
+ "rule1": {
+ ID: "01GP3AWY4CRDVRNZKW0TEAMB51",
+ CreatedAt: TimeMustParse("2022-05-14T12:20:03+02:00"),
+ UpdatedAt: TimeMustParse("2022-05-14T12:20:03+02:00"),
+ Text: "Be gay",
+ Deleted: util.Ptr(false),
+ Order: util.Ptr(uint(0)),
+ },
+ "deleted_rule": {
+ ID: "01GP3DFY9XQ1TJMZT5BGAZPXX2",
+ CreatedAt: TimeMustParse("2022-05-15T16:20:12+02:00"),
+ UpdatedAt: TimeMustParse("2022-05-15T16:20:12+02:00"),
+ Text: "Deleted",
+ Deleted: util.Ptr(true),
+ Order: util.Ptr(uint(1)),
+ },
+ "rule2": {
+ ID: "01GP3DFY9XQ1TJMZT5BGAZPXX3",
+ CreatedAt: TimeMustParse("2022-05-15T16:20:12+02:00"),
+ UpdatedAt: TimeMustParse("2022-05-15T16:20:12+02:00"),
+ Text: "Do crime",
+ Deleted: util.Ptr(false),
+ Order: util.Ptr(uint(2)),
+ },
+ }
+}
+
// ActivityWithSignature wraps a pub.Activity along with its signature headers, for testing.
type ActivityWithSignature struct {
Activity pub.Activity