diff options
Diffstat (limited to 'testrig')
-rw-r--r-- | testrig/federatingdb.go | 3 | ||||
-rw-r--r-- | testrig/federator.go | 3 | ||||
-rw-r--r-- | testrig/processor.go | 3 | ||||
-rw-r--r-- | testrig/typeconverter.go | 28 | ||||
-rw-r--r-- | testrig/util.go | 6 |
5 files changed, 9 insertions, 34 deletions
diff --git a/testrig/federatingdb.go b/testrig/federatingdb.go index b225039e2..a1215a7ba 100644 --- a/testrig/federatingdb.go +++ b/testrig/federatingdb.go @@ -20,9 +20,10 @@ package testrig import ( "github.com/superseriousbusiness/gotosocial/internal/federation/federatingdb" "github.com/superseriousbusiness/gotosocial/internal/state" + "github.com/superseriousbusiness/gotosocial/internal/typeutils" ) // NewTestFederatingDB returns a federating DB with the underlying db func NewTestFederatingDB(state *state.State) federatingdb.DB { - return federatingdb.New(state, NewTestTypeConverter(state.DB)) + return federatingdb.New(state, typeutils.NewConverter(state)) } diff --git a/testrig/federator.go b/testrig/federator.go index 765bb31d7..4d3d111cc 100644 --- a/testrig/federator.go +++ b/testrig/federator.go @@ -22,9 +22,10 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/media" "github.com/superseriousbusiness/gotosocial/internal/state" "github.com/superseriousbusiness/gotosocial/internal/transport" + "github.com/superseriousbusiness/gotosocial/internal/typeutils" ) // NewTestFederator returns a federator with the given database and (mock!!) transport controller. func NewTestFederator(state *state.State, tc transport.Controller, mediaManager *media.Manager) federation.Federator { - return federation.NewFederator(state, NewTestFederatingDB(state), tc, NewTestTypeConverter(state.DB), mediaManager) + return federation.NewFederator(state, NewTestFederatingDB(state), tc, typeutils.NewConverter(state), mediaManager) } diff --git a/testrig/processor.go b/testrig/processor.go index 0c6d97253..a30d183ed 100644 --- a/testrig/processor.go +++ b/testrig/processor.go @@ -23,11 +23,12 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/media" "github.com/superseriousbusiness/gotosocial/internal/processing" "github.com/superseriousbusiness/gotosocial/internal/state" + "github.com/superseriousbusiness/gotosocial/internal/typeutils" ) // NewTestProcessor returns a Processor suitable for testing purposes func NewTestProcessor(state *state.State, federator federation.Federator, emailSender email.Sender, mediaManager *media.Manager) *processing.Processor { - p := processing.NewProcessor(NewTestTypeConverter(state.DB), federator, NewTestOauthServer(state.DB), mediaManager, state, emailSender) + p := processing.NewProcessor(typeutils.NewConverter(state), federator, NewTestOauthServer(state.DB), mediaManager, state, emailSender) state.Workers.EnqueueClientAPI = p.Workers().EnqueueClientAPI state.Workers.EnqueueFediAPI = p.Workers().EnqueueFediAPI return p diff --git a/testrig/typeconverter.go b/testrig/typeconverter.go deleted file mode 100644 index bb680755a..000000000 --- a/testrig/typeconverter.go +++ /dev/null @@ -1,28 +0,0 @@ -// GoToSocial -// Copyright (C) GoToSocial Authors admin@gotosocial.org -// SPDX-License-Identifier: AGPL-3.0-or-later -// -// 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 testrig - -import ( - "github.com/superseriousbusiness/gotosocial/internal/db" - "github.com/superseriousbusiness/gotosocial/internal/typeutils" -) - -// NewTestTypeConverter returned a type converter with the given db and the default test config -func NewTestTypeConverter(db db.DB) typeutils.TypeConverter { - return typeutils.NewConverter(db) -} diff --git a/testrig/util.go b/testrig/util.go index f52ca6d5f..9512e3b6b 100644 --- a/testrig/util.go +++ b/testrig/util.go @@ -54,11 +54,11 @@ func StopWorkers(state *state.State) { _ = state.Workers.Media.Stop() } -func StartTimelines(state *state.State, filter *visibility.Filter, typeConverter typeutils.TypeConverter) { +func StartTimelines(state *state.State, filter *visibility.Filter, converter *typeutils.Converter) { state.Timelines.Home = timeline.NewManager( tlprocessor.HomeTimelineGrab(state), tlprocessor.HomeTimelineFilter(state, filter), - tlprocessor.HomeTimelineStatusPrepare(state, typeConverter), + tlprocessor.HomeTimelineStatusPrepare(state, converter), tlprocessor.SkipInsert(), ) if err := state.Timelines.Home.Start(); err != nil { @@ -68,7 +68,7 @@ func StartTimelines(state *state.State, filter *visibility.Filter, typeConverter state.Timelines.List = timeline.NewManager( tlprocessor.ListTimelineGrab(state), tlprocessor.ListTimelineFilter(state, filter), - tlprocessor.ListTimelineStatusPrepare(state, typeConverter), + tlprocessor.ListTimelineStatusPrepare(state, converter), tlprocessor.SkipInsert(), ) if err := state.Timelines.List.Start(); err != nil { |