From e05b99a0f16cb9e210cd7fb7bede94cda9b31ce6 Mon Sep 17 00:00:00 2001 From: James Houlahan Date: Sun, 20 Nov 2022 22:28:58 +0100 Subject: [PATCH] Other(test): Remove unneeded reporter expectations Gluon used to have a bug where it would unnecessarily call the reporter's ReportMessageWithContext method whenever an IMAP client would drop unexpectedly. After fixing the bug, we can remove these gomock EXPECT.AnyTimes() calls. --- go.mod | 2 +- go.sum | 4 ++-- internal/bridge/send_test.go | 3 --- internal/bridge/sync_test.go | 5 ----- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 2c6a0aed..ba7d5d2b 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/0xAX/notificator v0.0.0-20220220101646-ee9b8921e557 github.com/Masterminds/semver/v3 v3.1.1 - github.com/ProtonMail/gluon v0.13.1-0.20221117115028-b0f0a691266c + github.com/ProtonMail/gluon v0.13.1-0.20221120211716-a51f576947aa github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a github.com/ProtonMail/go-rfc5322 v0.11.0 github.com/ProtonMail/gopenpgp/v2 v2.4.10 diff --git a/go.sum b/go.sum index 79b9fab2..2b50f82b 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,8 @@ github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf h1:yc9daCCYUefEs github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf/go.mod h1:o0ESU9p83twszAU8LBeJKFAAMX14tISa0yk4Oo5TOqo= github.com/ProtonMail/docker-credential-helpers v1.1.0 h1:+kvUIpwWcbtP3WFv5sSvkFn/XLzSqPOB5AAthuk9xPk= github.com/ProtonMail/docker-credential-helpers v1.1.0/go.mod h1:mK0aBveCxhnQ756AmaTfXMZDeULvheYVhF/MWMErN5g= -github.com/ProtonMail/gluon v0.13.1-0.20221117115028-b0f0a691266c h1:uSCtzl/5zA5rL44kzhHzHwbtOReljKt+Cm+/q9sNLEU= -github.com/ProtonMail/gluon v0.13.1-0.20221117115028-b0f0a691266c/go.mod h1:XW/gcr4jErc5bX5yMqkUq3U+AucC2QZHJ5L231k3Nw4= +github.com/ProtonMail/gluon v0.13.1-0.20221120211716-a51f576947aa h1:vRuLSJ8cb+OYaUIXQ0Zn3qnF4SwlHkCOl0mYF8wwWd8= +github.com/ProtonMail/gluon v0.13.1-0.20221120211716-a51f576947aa/go.mod h1:XW/gcr4jErc5bX5yMqkUq3U+AucC2QZHJ5L231k3Nw4= github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a h1:D+aZah+k14Gn6kmL7eKxoo/4Dr/lK3ChBcwce2+SQP4= github.com/ProtonMail/go-autostart v0.0.0-20210130080809-00ed301c8e9a/go.mod h1:oTGdE7/DlWIr23G0IKW3OXK9wZ5Hw1GGiaJFccTvZi4= github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= diff --git a/internal/bridge/send_test.go b/internal/bridge/send_test.go index b24edf7e..03af9382 100644 --- a/internal/bridge/send_test.go +++ b/internal/bridge/send_test.go @@ -32,7 +32,6 @@ import ( "github.com/emersion/go-imap/client" "github.com/emersion/go-sasl" "github.com/emersion/go-smtp" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "gitlab.protontech.ch/go/liteapi" "gitlab.protontech.ch/go/liteapi/server" @@ -44,8 +43,6 @@ func TestBridge_Send(t *testing.T) { require.NoError(t, err) withBridge(ctx, t, s.GetHostURL(), netCtl, locator, storeKey, func(bridge *bridge.Bridge, mocks *bridge.Mocks) { - mocks.Reporter.EXPECT().ReportMessageWithContext(gomock.Any(), gomock.Any()).AnyTimes() - senderUserID, err := bridge.LoginFull(ctx, username, password, nil, nil) require.NoError(t, err) diff --git a/internal/bridge/sync_test.go b/internal/bridge/sync_test.go index 9590745c..03004fe8 100644 --- a/internal/bridge/sync_test.go +++ b/internal/bridge/sync_test.go @@ -32,7 +32,6 @@ import ( "github.com/bradenaw/juniper/iterator" "github.com/bradenaw/juniper/stream" "github.com/emersion/go-imap/client" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "gitlab.protontech.ch/go/liteapi" "gitlab.protontech.ch/go/liteapi/server" @@ -70,8 +69,6 @@ func TestBridge_Sync(t *testing.T) { // If we then connect an IMAP client, it should see all the messages. withBridge(ctx, t, s.GetHostURL(), netCtl, locator, storeKey, func(b *bridge.Bridge, mocks *bridge.Mocks) { - mocks.Reporter.EXPECT().ReportMessageWithContext(gomock.Any(), gomock.Any()).AnyTimes() - info, err := b.GetUserInfo(userID) require.NoError(t, err) require.True(t, info.State == bridge.Connected) @@ -96,8 +93,6 @@ func TestBridge_Sync(t *testing.T) { // Login the user; its sync should fail. withBridge(ctx, t, s.GetHostURL(), netCtl, locator, storeKey, func(b *bridge.Bridge, mocks *bridge.Mocks) { - mocks.Reporter.EXPECT().ReportMessageWithContext(gomock.Any(), gomock.Any()).AnyTimes() - { syncCh, done := chToType[events.Event, events.SyncFailed](b.GetEvents(events.SyncFailed{})) defer done()