@@ -2,7 +2,6 @@ import 'package:checks/checks.dart';
22import 'package:flutter/foundation.dart' ;
33import 'package:flutter_test/flutter_test.dart' ;
44import 'package:http/http.dart' as http;
5- import 'package:zulip/api/exception.dart' ;
65import 'package:zulip/model/actions.dart' ;
76import 'package:zulip/model/store.dart' ;
87import 'package:zulip/notifications/receive.dart' ;
@@ -102,13 +101,7 @@ void main() {
102101 check (testBinding.globalStore).accountIds.single.equals (eg.selfAccount.id);
103102 const unregisterDelay = Duration (seconds: 5 );
104103 assert (unregisterDelay > TestGlobalStore .removeAccountDuration);
105- final exception = ZulipApiException (
106- httpStatus: 401 ,
107- code: 'UNAUTHORIZED' ,
108- data: {},
109- routeName: 'removeEtcEtcToken' ,
110- message: 'Invalid API key' ,
111- );
104+ final exception = eg.apiExceptionUnauthorized (routeName: 'removeEtcEtcToken' );
112105 final newConnection = separateConnection ()
113106 ..prepare (delay: unregisterDelay, exception: exception);
114107
@@ -170,14 +163,9 @@ void main() {
170163 test ('connection closed if request errors' , () => awaitFakeAsync ((async ) async {
171164 await prepare (ackedPushToken: '123' );
172165
166+ final exception = eg.apiExceptionUnauthorized (routeName: 'removeEtcEtcToken' );
173167 final newConnection = separateConnection ()
174- ..prepare (exception: ZulipApiException (
175- httpStatus: 401 ,
176- code: 'UNAUTHORIZED' ,
177- data: {},
178- routeName: 'removeEtcEtcToken' ,
179- message: 'Invalid API key' ,
180- ));
168+ ..prepare (exception: exception);
181169 final future = unregisterToken (testBinding.globalStore, eg.selfAccount.id);
182170 async .elapse (Duration .zero);
183171 await future;
0 commit comments