@@ -181,7 +181,7 @@ func TestHandleNewQuestionNotificationEnqueuesEmailTask(t *testing.T) {
181181 },
182182 siteInfoService : siteInfoService ,
183183 }
184- service .newQuestionEmailWorker = newUnstartedNewQuestionEmailWorkerForTest (1 )
184+ service .newQuestionEmailWorker = newUnstartedNewQuestionEmailWorkerForTest ()
185185
186186 err = service .handleNewQuestionNotification (context .Background (), & schema.ExternalNotificationMsg {
187187 NewQuestionTemplateRawData : & schema.NewQuestionTemplateRawData {
@@ -243,7 +243,7 @@ func TestHandleNewQuestionNotificationSkipsEnqueueWithoutEnabledEmailAttempts(t
243243 "all-user" : newQuestionNotificationTestUser ("all-user" ),
244244 },
245245 },
246- newQuestionEmailWorker : newUnstartedNewQuestionEmailWorkerForTest (1 ),
246+ newQuestionEmailWorker : newUnstartedNewQuestionEmailWorkerForTest (),
247247 }
248248
249249 err = service .handleNewQuestionNotification (context .Background (), & schema.ExternalNotificationMsg {
@@ -271,7 +271,7 @@ func TestHandleNewQuestionNotificationReturnsWhenEmailWorkerQueueFull(t *testing
271271 }
272272 t .Cleanup (cleanup )
273273
274- worker := newUnstartedNewQuestionEmailWorkerForTest (1 )
274+ worker := newUnstartedNewQuestionEmailWorkerForTest ()
275275 if ! worker .TryEnqueue (newQuestionEmailWorkerTask ("already-queued" , "queued-user" )) {
276276 t .Fatalf ("pre-fill TryEnqueue() = false, want true" )
277277 }
@@ -332,7 +332,7 @@ func TestHandleNewQuestionNotificationSyncsPluginBeforeEmailEnqueue(t *testing.T
332332 releaseNotify := make (chan struct {})
333333 enableNewQuestionNotificationTestPlugin (t , notifyStarted , releaseNotify )
334334
335- worker := newUnstartedNewQuestionEmailWorkerForTest (1 )
335+ worker := newUnstartedNewQuestionEmailWorkerForTest ()
336336 service := & ExternalNotificationService {
337337 data : & basedata.Data {Cache : cache },
338338 userNotificationConfigRepo : & newQuestionNotificationTestUserNotificationConfigRepo {
@@ -428,27 +428,13 @@ func setNewQuestionNotificationEmailSendIntervalEnv(t *testing.T, value string,
428428 })
429429}
430430
431- func newQuestionSubscriber (userID string , channels ... * schema.NotificationChannelConfig ) * NewQuestionSubscriber {
432- return & NewQuestionSubscriber {
433- UserID : userID ,
434- Channels : channels ,
435- }
436- }
437-
438431func newQuestionEmailChannel (enable bool ) * schema.NotificationChannelConfig {
439432 return & schema.NotificationChannelConfig {
440433 Key : constant .EmailChannel ,
441434 Enable : enable ,
442435 }
443436}
444437
445- func newQuestionNonEmailChannel (enable bool ) * schema.NotificationChannelConfig {
446- return & schema.NotificationChannelConfig {
447- Key : constant .NotificationChannelKey ("inbox" ),
448- Enable : enable ,
449- }
450- }
451-
452438func newQuestionNotificationConfig (
453439 userID string , source constant.NotificationSource , emailEnabled bool ) * entity.UserNotificationConfig {
454440 channels := schema.NotificationChannels {
@@ -702,14 +688,6 @@ func (r *newQuestionNotificationTestEmailRepo) VerifyCode(context.Context, strin
702688 return "" , nil
703689}
704690
705- func (r * newQuestionNotificationTestEmailRepo ) userIDs () []string {
706- userIDs := make ([]string , 0 , len (r .codesByUserID ))
707- for userID := range r .codesByUserID {
708- userIDs = append (userIDs , userID )
709- }
710- return userIDs
711- }
712-
713691var (
714692 newQuestionNotificationTestPluginOnce sync.Once
715693 newQuestionNotificationTestPluginInst = & newQuestionNotificationTestPlugin {}
@@ -820,3 +798,18 @@ func (newQuestionNotificationTestUserExternalLoginRepo) GetCacheUserExternalLogi
820798 context.Context , string ) (* schema.ExternalLoginUserInfoCache , error ) {
821799 return nil , nil
822800}
801+
802+ func (newQuestionNotificationTestUserExternalLoginRepo ) SetCacheOAuthState (
803+ context.Context , string , * schema.ExternalLoginOAuthState , time.Duration ) error {
804+ return nil
805+ }
806+
807+ func (newQuestionNotificationTestUserExternalLoginRepo ) GetCacheOAuthState (
808+ context.Context , string ) (* schema.ExternalLoginOAuthState , error ) {
809+ return nil , nil
810+ }
811+
812+ func (newQuestionNotificationTestUserExternalLoginRepo ) DeleteCacheOAuthState (
813+ context.Context , string ) error {
814+ return nil
815+ }
0 commit comments