2021-05-08 13:25:55 +01:00
|
|
|
/*
|
|
|
|
GoToSocial
|
2021-12-20 17:42:19 +00:00
|
|
|
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
|
2021-05-08 13:25:55 +01:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package federation_test
|
|
|
|
|
|
|
|
import (
|
2021-11-13 11:29:08 +00:00
|
|
|
"codeberg.org/gruf/go-store/kv"
|
2021-05-08 13:25:55 +01:00
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
|
|
|
|
"github.com/superseriousbusiness/gotosocial/internal/db"
|
|
|
|
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
|
|
|
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
|
|
|
"github.com/superseriousbusiness/gotosocial/testrig"
|
|
|
|
)
|
|
|
|
|
2022-04-29 14:05:13 +01:00
|
|
|
type FederatorStandardTestSuite struct {
|
2021-05-08 13:25:55 +01:00
|
|
|
suite.Suite
|
|
|
|
db db.DB
|
2021-09-11 20:12:47 +01:00
|
|
|
storage *kv.KVStore
|
2021-05-08 13:25:55 +01:00
|
|
|
typeConverter typeutils.TypeConverter
|
|
|
|
accounts map[string]*gtsmodel.Account
|
|
|
|
activities map[string]testrig.ActivityWithSignature
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetupSuite sets some variables on the suite that we can use as consts (more or less) throughout
|
2022-04-29 14:05:13 +01:00
|
|
|
func (suite *FederatorStandardTestSuite) SetupSuite() {
|
2021-05-08 13:25:55 +01:00
|
|
|
// setup standard items
|
|
|
|
suite.storage = testrig.NewTestStorage()
|
|
|
|
suite.typeConverter = testrig.NewTestTypeConverter(suite.db)
|
|
|
|
suite.accounts = testrig.NewTestAccounts()
|
|
|
|
}
|
|
|
|
|
2022-04-29 14:05:13 +01:00
|
|
|
func (suite *FederatorStandardTestSuite) SetupTest() {
|
2021-12-07 12:31:39 +00:00
|
|
|
testrig.InitTestConfig()
|
2022-04-29 14:05:13 +01:00
|
|
|
testrig.InitTestLog()
|
2021-12-07 12:31:39 +00:00
|
|
|
suite.db = testrig.NewTestDB()
|
|
|
|
suite.activities = testrig.NewTestActivities(suite.accounts)
|
2021-08-10 12:32:39 +01:00
|
|
|
testrig.StandardDBSetup(suite.db, suite.accounts)
|
2021-05-08 13:25:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// TearDownTest drops tables to make sure there's no data in the db
|
2022-04-29 14:05:13 +01:00
|
|
|
func (suite *FederatorStandardTestSuite) TearDownTest() {
|
2021-05-08 13:25:55 +01:00
|
|
|
testrig.StandardDBTeardown(suite.db)
|
|
|
|
}
|