summaryrefslogtreecommitdiff
path: root/internal/validate
diff options
context:
space:
mode:
Diffstat (limited to 'internal/validate')
-rw-r--r--internal/validate/account_test.go13
-rw-r--r--internal/validate/domainblock_test.go3
-rw-r--r--internal/validate/emoji_test.go5
-rw-r--r--internal/validate/mediaattachment_test.go5
-rw-r--r--internal/validate/status_test.go17
-rw-r--r--internal/validate/tag_test.go5
-rw-r--r--internal/validate/user_test.go9
7 files changed, 32 insertions, 25 deletions
diff --git a/internal/validate/account_test.go b/internal/validate/account_test.go
index e0dda8e16..1c318b4ef 100644
--- a/internal/validate/account_test.go
+++ b/internal/validate/account_test.go
@@ -28,6 +28,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
+ "github.com/superseriousbusiness/gotosocial/testrig"
)
func happyAccount() *gtsmodel.Account {
@@ -52,15 +53,15 @@ func happyAccount() *gtsmodel.Account {
DisplayName: "original zork (he/they)",
Fields: []gtsmodel.Field{},
Note: "hey yo this is my profile!",
- Memorial: false,
+ Memorial: testrig.FalseBool(),
AlsoKnownAs: "",
MovedToAccountID: "",
- Bot: false,
+ Bot: testrig.FalseBool(),
Reason: "I wanna be on this damned webbed site so bad! Please! Wow",
- Locked: false,
- Discoverable: true,
+ Locked: testrig.FalseBool(),
+ Discoverable: testrig.TrueBool(),
Privacy: gtsmodel.VisibilityPublic,
- Sensitive: false,
+ Sensitive: testrig.FalseBool(),
Language: "en",
StatusFormat: "plain",
URI: "http://localhost:8080/users/the_mighty_zork",
@@ -78,7 +79,7 @@ func happyAccount() *gtsmodel.Account {
SensitizedAt: time.Time{},
SilencedAt: time.Time{},
SuspendedAt: time.Time{},
- HideCollections: false,
+ HideCollections: testrig.FalseBool(),
SuspensionOrigin: "",
}
}
diff --git a/internal/validate/domainblock_test.go b/internal/validate/domainblock_test.go
index cb43a52a5..1406e539c 100644
--- a/internal/validate/domainblock_test.go
+++ b/internal/validate/domainblock_test.go
@@ -25,6 +25,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
+ "github.com/superseriousbusiness/gotosocial/testrig"
)
func happyDomainBlock() *gtsmodel.DomainBlock {
@@ -36,7 +37,7 @@ func happyDomainBlock() *gtsmodel.DomainBlock {
CreatedByAccountID: "01FEED79PRMVWPRMFHFQM8MJQN",
PrivateComment: "we don't like em",
PublicComment: "poo poo dudes",
- Obfuscate: false,
+ Obfuscate: testrig.FalseBool(),
SubscriptionID: "",
}
}
diff --git a/internal/validate/emoji_test.go b/internal/validate/emoji_test.go
index 4ea90f384..8bf5d65e0 100644
--- a/internal/validate/emoji_test.go
+++ b/internal/validate/emoji_test.go
@@ -26,6 +26,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
+ "github.com/superseriousbusiness/gotosocial/testrig"
)
func happyEmoji() *gtsmodel.Emoji {
@@ -73,9 +74,9 @@ func happyEmoji() *gtsmodel.Emoji {
ImageFileSize: 1024,
ImageStaticFileSize: 256,
ImageUpdatedAt: time.Now(),
- Disabled: false,
+ Disabled: testrig.FalseBool(),
URI: "https://example.org/emojis/blob_test",
- VisibleInPicker: true,
+ VisibleInPicker: testrig.TrueBool(),
CategoryID: "01FEE47ZH70PWDSEAVBRFNX325",
}
}
diff --git a/internal/validate/mediaattachment_test.go b/internal/validate/mediaattachment_test.go
index 14a835014..491e974f9 100644
--- a/internal/validate/mediaattachment_test.go
+++ b/internal/validate/mediaattachment_test.go
@@ -26,6 +26,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
+ "github.com/superseriousbusiness/gotosocial/testrig"
)
func happyMediaAttachment() *gtsmodel.MediaAttachment {
@@ -97,8 +98,8 @@ func happyMediaAttachment() *gtsmodel.MediaAttachment {
URL: "http://localhost:8080/fileserver/01F8MH17FWEB39HZJ76B6VXSKF/attachment/small/01F8MH6NEM8D7527KZAECTCR76.jpeg",
RemoteURL: "",
},
- Avatar: false,
- Header: false,
+ Avatar: testrig.FalseBool(),
+ Header: testrig.FalseBool(),
}
}
diff --git a/internal/validate/status_test.go b/internal/validate/status_test.go
index cd3bc0f04..bebd3affd 100644
--- a/internal/validate/status_test.go
+++ b/internal/validate/status_test.go
@@ -26,6 +26,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
+ "github.com/superseriousbusiness/gotosocial/testrig"
)
func happyStatus() *gtsmodel.Status {
@@ -44,7 +45,7 @@ func happyStatus() *gtsmodel.Status {
Mentions: nil,
EmojiIDs: nil,
Emojis: nil,
- Local: true,
+ Local: testrig.TrueBool(),
AccountID: "01FEBBQ4KEP3824WW61MF52638",
Account: nil,
AccountURI: "https://example.org/users/test_user",
@@ -59,17 +60,17 @@ func happyStatus() *gtsmodel.Status {
BoostOfAccount: nil,
ContentWarning: "hello world test post",
Visibility: gtsmodel.VisibilityPublic,
- Sensitive: false,
+ Sensitive: testrig.FalseBool(),
Language: "en",
CreatedWithApplicationID: "01FEBBZHF4GFVRXSJVXD0JTZZ2",
CreatedWithApplication: nil,
- Federated: true,
- Boostable: true,
- Replyable: true,
- Likeable: true,
+ Federated: testrig.TrueBool(),
+ Boostable: testrig.TrueBool(),
+ Replyable: testrig.TrueBool(),
+ Likeable: testrig.TrueBool(),
ActivityStreamsType: ap.ObjectNote,
Text: "Test status! #hello",
- Pinned: false,
+ Pinned: testrig.FalseBool(),
}
}
@@ -127,7 +128,7 @@ func (suite *StatusValidateTestSuite) TestStatusApplicationID() {
err := validate.Struct(s)
suite.EqualError(err, "Key: 'Status.CreatedWithApplicationID' Error:Field validation for 'CreatedWithApplicationID' failed on the 'required_if' tag")
- s.Local = false
+ s.Local = testrig.FalseBool()
err = validate.Struct(s)
suite.NoError(err)
}
diff --git a/internal/validate/tag_test.go b/internal/validate/tag_test.go
index 451863570..506563a7c 100644
--- a/internal/validate/tag_test.go
+++ b/internal/validate/tag_test.go
@@ -25,6 +25,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
+ "github.com/superseriousbusiness/gotosocial/testrig"
)
func happyTag() *gtsmodel.Tag {
@@ -35,8 +36,8 @@ func happyTag() *gtsmodel.Tag {
URL: "https://example.org/tags/some_tag",
Name: "some_tag",
FirstSeenFromAccountID: "01FE91SR5P2GW06K3AJ98P72MT",
- Useable: true,
- Listable: true,
+ Useable: testrig.TrueBool(),
+ Listable: testrig.TrueBool(),
LastStatusAt: time.Now(),
}
}
diff --git a/internal/validate/user_test.go b/internal/validate/user_test.go
index f755ac42a..06c8bb0ac 100644
--- a/internal/validate/user_test.go
+++ b/internal/validate/user_test.go
@@ -26,6 +26,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/validate"
+ "github.com/superseriousbusiness/gotosocial/testrig"
)
func happyUser() *gtsmodel.User {
@@ -54,10 +55,10 @@ func happyUser() *gtsmodel.User {
ConfirmedAt: time.Now(),
ConfirmationSentAt: time.Time{},
UnconfirmedEmail: "",
- Moderator: false,
- Admin: false,
- Disabled: false,
- Approved: true,
+ Moderator: testrig.FalseBool(),
+ Admin: testrig.FalseBool(),
+ Disabled: testrig.FalseBool(),
+ Approved: testrig.TrueBool(),
}
}