summaryrefslogtreecommitdiff
path: root/internal/api/s2s/user/user_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-09-20 16:46:45 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-20 16:46:45 +0200
commitb315eee43b1e40a10ddf95786e516a4ac459510c (patch)
tree6338f12d50af8e7fdfe01c575b3b8425974da69e /internal/api/s2s/user/user_test.go
parentfederated authentication better logging + tidying (#232) (diff)
downloadgotosocial-b315eee43b1e40a10ddf95786e516a4ac459510c.tar.xz
Update webfingering a little, add tests (#236)
* Update webfingering a little, add tests * fix broken tests oops
Diffstat (limited to 'internal/api/s2s/user/user_test.go')
-rw-r--r--internal/api/s2s/user/user_test.go31
1 files changed, 30 insertions, 1 deletions
diff --git a/internal/api/s2s/user/user_test.go b/internal/api/s2s/user/user_test.go
index 269ca4bab..768dd941b 100644
--- a/internal/api/s2s/user/user_test.go
+++ b/internal/api/s2s/user/user_test.go
@@ -12,9 +12,9 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/processing"
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
+ "github.com/superseriousbusiness/gotosocial/testrig"
)
-// nolint
type UserStandardTestSuite struct {
// standard suite interfaces
suite.Suite
@@ -39,3 +39,32 @@ type UserStandardTestSuite struct {
// module being tested
userModule *user.Module
}
+
+func (suite *UserStandardTestSuite) SetupSuite() {
+ suite.testTokens = testrig.NewTestTokens()
+ suite.testClients = testrig.NewTestClients()
+ suite.testApplications = testrig.NewTestApplications()
+ suite.testUsers = testrig.NewTestUsers()
+ suite.testAccounts = testrig.NewTestAccounts()
+ suite.testAttachments = testrig.NewTestAttachments()
+ suite.testStatuses = testrig.NewTestStatuses()
+}
+
+func (suite *UserStandardTestSuite) SetupTest() {
+ suite.config = testrig.NewTestConfig()
+ suite.db = testrig.NewTestDB()
+ suite.tc = testrig.NewTestTypeConverter(suite.db)
+ suite.storage = testrig.NewTestStorage()
+ suite.log = testrig.NewTestLog()
+ suite.federator = testrig.NewTestFederator(suite.db, testrig.NewTestTransportController(testrig.NewMockHTTPClient(nil), suite.db), suite.storage)
+ suite.processor = testrig.NewTestProcessor(suite.db, suite.storage, suite.federator)
+ suite.userModule = user.New(suite.config, suite.processor, suite.log).(*user.Module)
+ suite.securityModule = security.New(suite.config, suite.db, suite.log).(*security.Module)
+ testrig.StandardDBSetup(suite.db, suite.testAccounts)
+ testrig.StandardStorageSetup(suite.storage, "../../../../testrig/media")
+}
+
+func (suite *UserStandardTestSuite) TearDownTest() {
+ testrig.StandardDBTeardown(suite.db)
+ testrig.StandardStorageTeardown(suite.storage)
+}