mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-29 23:16:16 -06:00
Move webpush.MockSender and noopSender into testrig
This commit is contained in:
parent
d89f3ec8f1
commit
b3aab4f0de
40 changed files with 66 additions and 128 deletions
|
|
@ -50,7 +50,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/tracing"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/web"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -165,7 +164,7 @@ var Start action.GTSAction = func(ctx context.Context) error {
|
|||
federator := testrig.NewTestFederator(state, transportController, mediaManager)
|
||||
|
||||
emailSender := testrig.NewEmailSender("./web/template/", nil)
|
||||
webPushSender := webpush.NewMockSender()
|
||||
webPushSender := testrig.NewWebPushMockSender()
|
||||
typeConverter := typeutils.NewConverter(state)
|
||||
filter := visibility.NewFilter(state)
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -93,7 +92,7 @@ func (suite *EmojiGetTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.emojiModule = emoji.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -105,7 +104,7 @@ func (suite *UserStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
testrig.StartWorkers(&suite.state, suite.processor.Workers())
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/processing"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -96,7 +95,7 @@ func (suite *AuthStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.authModule = auth.New(suite.db, suite.processor, suite.idp)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -105,7 +104,7 @@ func (suite *AccountStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.accountsModule = accounts.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -111,7 +110,7 @@ func (suite *AdminStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.adminModule = admin.New(&suite.state, suite.processor)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -119,7 +118,7 @@ func (suite *BookmarkTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.statusModule = statuses.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -96,7 +95,7 @@ func (suite *ExportsTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
federator,
|
||||
testrig.NewEmailSender("../../../../web/template/", nil),
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
mediaManager,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -103,7 +102,7 @@ func (suite *FavouritesStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.favModule = favourites.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/stream"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -110,7 +109,7 @@ func (suite *FiltersTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.filtersModule = filtersV1.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/stream"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -109,7 +108,7 @@ func (suite *FiltersTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.filtersModule = filtersV2.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/processing"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -93,7 +92,7 @@ func (suite *FollowedTagsTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.followedTagsModule = followedtags.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -101,7 +100,7 @@ func (suite *FollowRequestStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.followRequestModule = followrequests.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -93,7 +92,7 @@ func (suite *ImportTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
federator,
|
||||
testrig.NewEmailSender("../../../../web/template/", nil),
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
mediaManager,
|
||||
)
|
||||
testrig.StartWorkers(&suite.state, processor.Workers())
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -104,7 +103,7 @@ func (suite *InstanceStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.instanceModule = instance.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -104,7 +103,7 @@ func (suite *ListsStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.listsModule = lists.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -109,7 +108,7 @@ func (suite *MediaCreateTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -107,7 +106,7 @@ func (suite *MediaUpdateTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -101,7 +100,7 @@ func (suite *MutesTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.mutesModule = mutes.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -105,7 +104,7 @@ func (suite *NotificationsTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.notificationsModule = notifications.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -44,7 +43,7 @@ type PollsStandardTestSuite struct {
|
|||
processor *processing.Processor
|
||||
emailSender email.Sender
|
||||
sentEmails map[string]string
|
||||
webPushSender *webpush.MockSender
|
||||
webPushSender *testrig.WebPushMockSender
|
||||
state state.State
|
||||
|
||||
// standard suite models
|
||||
|
|
@ -97,7 +96,7 @@ func (suite *PollsStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.pollsModule = polls.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/processing"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -91,7 +90,7 @@ func (suite *PushTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.pushModule = push.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -96,7 +95,7 @@ func (suite *ReportsStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.reportsModule = reports.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -100,7 +99,7 @@ func (suite *SearchStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.searchModule = search.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -216,7 +215,7 @@ func (suite *StatusStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.statusModule = statuses.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -116,7 +115,7 @@ func (suite *StreamingTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.streamingModule = streaming.New(suite.processor, 1, 4096)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/processing"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -101,7 +100,7 @@ func (suite *TagsTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.tagsModule = tags.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/api/client/user"
|
||||
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -45,7 +44,7 @@ func (suite *EmailChangeTestSuite) TestEmailChangePOST() {
|
|||
storage := testrig.NewInMemoryStorage()
|
||||
sentEmails := make(map[string]string)
|
||||
emailSender := testrig.NewEmailSender("../../../../web/template/", sentEmails)
|
||||
webPushSender := webpush.NewNoopSender()
|
||||
webPushSender := testrig.NewNoopWebPushSender()
|
||||
processor := testrig.NewTestProcessor(state, suite.federator, emailSender, webPushSender, suite.mediaManager)
|
||||
testrig.StartWorkers(state, processor.Workers())
|
||||
userModule := user.New(processor)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -99,7 +98,7 @@ func (suite *UserStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
testrig.NewEmailSender("../../../../web/template/", nil),
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.userModule = user.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -88,7 +87,7 @@ func (suite *FileserverTestSuite) SetupSuite() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -99,7 +98,7 @@ func (suite *WebfingerStandardTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
suite.webfingerModule = webfinger.New(suite.processor)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/processing"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/subscriptions"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -99,7 +98,7 @@ func (suite *WebfingerGetTestSuite) funkifyAccountDomain(host string, accountDom
|
|||
testrig.NewTestMediaManager(&suite.state),
|
||||
&suite.state,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
visibility.NewFilter(&suite.state),
|
||||
interaction.NewFilter(&suite.state),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/subscriptions"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/transport"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -120,7 +119,7 @@ func (suite *AdminStandardTestSuite) SetupTest() {
|
|||
suite.mediaManager,
|
||||
&suite.state,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
visibility.NewFilter(&suite.state),
|
||||
interaction.NewFilter(&suite.state),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/subscriptions"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/transport"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -136,7 +135,7 @@ func (suite *ProcessingStandardTestSuite) SetupTest() {
|
|||
suite.mediaManager,
|
||||
&suite.state,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
visibility.NewFilter(&suite.state),
|
||||
interaction.NewFilter(&suite.state),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/stream"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/util"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -182,7 +181,7 @@ func (suite *FromClientAPITestSuite) checkStreamed(
|
|||
|
||||
// checkWebPushed asserts that the target account got a single Web Push notification with a given type.
|
||||
func (suite *FromClientAPITestSuite) checkWebPushed(
|
||||
sender *webpush.MockSender,
|
||||
sender *testrig.WebPushMockSender,
|
||||
accountID string,
|
||||
notificationType gtsmodel.NotificationType,
|
||||
) {
|
||||
|
|
@ -195,7 +194,7 @@ func (suite *FromClientAPITestSuite) checkWebPushed(
|
|||
|
||||
// checkNotWebPushed asserts that the target account got no Web Push notifications.
|
||||
func (suite *FromClientAPITestSuite) checkNotWebPushed(
|
||||
sender *webpush.MockSender,
|
||||
sender *testrig.WebPushMockSender,
|
||||
accountID string,
|
||||
) {
|
||||
pushedNotifications := sender.Sent[accountID]
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/storage"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/transport"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -94,7 +93,7 @@ func (suite *TransportTestSuite) SetupTest() {
|
|||
&suite.state,
|
||||
suite.federator,
|
||||
suite.emailSender,
|
||||
webpush.NewNoopSender(),
|
||||
testrig.NewNoopWebPushSender(),
|
||||
suite.mediaManager,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/processing"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/state"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||
)
|
||||
|
||||
|
|
@ -541,7 +540,7 @@ func (suite *TypeUtilsTestSuite) GetProcessor() *processing.Processor {
|
|||
mediaManager := testrig.NewTestMediaManager(&suite.state)
|
||||
federator := testrig.NewTestFederator(&suite.state, transportController, mediaManager)
|
||||
emailSender := testrig.NewEmailSender("../../web/template/", nil)
|
||||
webPushSender := webpush.NewNoopSender()
|
||||
webPushSender := testrig.NewNoopWebPushSender()
|
||||
|
||||
processor := testrig.NewTestProcessor(&suite.state, federator, emailSender, webPushSender, mediaManager)
|
||||
testrig.StartWorkers(&suite.state, processor.Workers())
|
||||
|
|
|
|||
|
|
@ -1,42 +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 webpush
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/superseriousbusiness/gotosocial/internal/filter/usermute"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
)
|
||||
|
||||
// noopSender drops anything sent to it.
|
||||
// This should only be used in tests.
|
||||
type noopSender struct{}
|
||||
|
||||
func NewNoopSender() Sender {
|
||||
return &noopSender{}
|
||||
}
|
||||
|
||||
func (n *noopSender) Send(
|
||||
ctx context.Context,
|
||||
notification *gtsmodel.Notification,
|
||||
filters []*gtsmodel.Filter,
|
||||
mutes *usermute.CompiledUserMuteList,
|
||||
) error {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -29,7 +29,6 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/subscriptions"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/transport"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/typeutils"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
)
|
||||
|
||||
// TestStructs encapsulates structs needed to
|
||||
|
|
@ -48,7 +47,7 @@ type TestStructs struct {
|
|||
HTTPClient *MockHTTPClient
|
||||
TypeConverter *typeutils.Converter
|
||||
EmailSender email.Sender
|
||||
WebPushSender *webpush.MockSender
|
||||
WebPushSender *WebPushMockSender
|
||||
TransportController transport.Controller
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +84,7 @@ func SetupTestStructs(
|
|||
federator := NewTestFederator(&state, transportController, mediaManager)
|
||||
oauthServer := NewTestOauthServer(db)
|
||||
emailSender := NewEmailSender(rTemplatePath, nil)
|
||||
webPushSender := webpush.NewMockSender()
|
||||
webPushSender := NewWebPushMockSender()
|
||||
|
||||
common := common.New(
|
||||
&state,
|
||||
|
|
|
|||
|
|
@ -15,28 +15,29 @@
|
|||
// 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 webpush
|
||||
package testrig
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/superseriousbusiness/gotosocial/internal/filter/usermute"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/webpush"
|
||||
)
|
||||
|
||||
// MockSender collects a map of notifications sent to each account ID.
|
||||
// This should only be used in tests.
|
||||
type MockSender struct {
|
||||
// WebPushMockSender collects a map of notifications sent to each account ID.
|
||||
type WebPushMockSender struct {
|
||||
Sent map[string][]*gtsmodel.Notification
|
||||
}
|
||||
|
||||
func NewMockSender() *MockSender {
|
||||
return &MockSender{
|
||||
// NewWebPushMockSender creates a mock sender that can record sent Web Push notifications for test expectations.
|
||||
func NewWebPushMockSender() *WebPushMockSender {
|
||||
return &WebPushMockSender{
|
||||
Sent: map[string][]*gtsmodel.Notification{},
|
||||
}
|
||||
}
|
||||
|
||||
func (m *MockSender) Send(
|
||||
func (m *WebPushMockSender) Send(
|
||||
ctx context.Context,
|
||||
notification *gtsmodel.Notification,
|
||||
filters []*gtsmodel.Filter,
|
||||
|
|
@ -45,3 +46,20 @@ func (m *MockSender) Send(
|
|||
m.Sent[notification.TargetAccountID] = append(m.Sent[notification.TargetAccountID], notification)
|
||||
return nil
|
||||
}
|
||||
|
||||
// noopSender drops anything sent to it.
|
||||
type noopWebPushSender struct{}
|
||||
|
||||
// NewNoopWebPushSender creates a no-op sender that does nothing.
|
||||
func NewNoopWebPushSender() webpush.Sender {
|
||||
return &noopWebPushSender{}
|
||||
}
|
||||
|
||||
func (n *noopWebPushSender) Send(
|
||||
ctx context.Context,
|
||||
notification *gtsmodel.Notification,
|
||||
filters []*gtsmodel.Filter,
|
||||
mutes *usermute.CompiledUserMuteList,
|
||||
) error {
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue