Skip to content

Commit 036b4de

Browse files
authored
Remove fake HTTP GET bridge from the tests used by SearchClient. (dart-lang#8723)
1 parent 4914f01 commit 036b4de

File tree

3 files changed

+1
-92
lines changed

3 files changed

+1
-92
lines changed

app/lib/tool/utils/http_client_to_shelf_handler.dart

Lines changed: 0 additions & 68 deletions
This file was deleted.

app/test/frontend/handlers/listing_test.dart

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'package:http/testing.dart';
6-
import 'package:pub_dev/package/name_tracker.dart';
7-
import 'package:pub_dev/search/search_client.dart';
85
import 'package:pub_dev/tool/test_profile/models.dart';
96
import 'package:test/test.dart';
107

@@ -72,17 +69,6 @@ void main() {
7269
);
7370
});
7471

75-
testWithProfile('/packages?q=oxyge without working search', fn: () async {
76-
registerSearchClient(
77-
SearchClient(MockClient((_) async => throw Exception())));
78-
await nameTracker.reloadFromDatastore();
79-
final content = await expectHtmlResponse(
80-
await issueGet('/packages?q=oxyge'),
81-
status: 503,
82-
);
83-
expect(content, contains('oxygen is awesome'));
84-
});
85-
8672
testWithProfile('/packages?page=2',
8773
testProfile: TestProfile(
8874
defaultUser: '[email protected]',

app/test/shared/test_services.dart

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import 'package:pub_dev/fake/backend/fake_pub_worker.dart';
1717
import 'package:pub_dev/frontend/handlers/pubapi.client.dart';
1818
import 'package:pub_dev/frontend/static_files.dart';
1919
import 'package:pub_dev/package/name_tracker.dart';
20-
import 'package:pub_dev/search/handlers.dart';
21-
import 'package:pub_dev/search/search_client.dart';
2220
import 'package:pub_dev/search/top_packages.dart';
2321
import 'package:pub_dev/search/updater.dart';
2422
import 'package:pub_dev/service/async_queue/async_queue.dart';
@@ -35,7 +33,6 @@ import 'package:pub_dev/tool/neat_task/pub_dev_tasks.dart';
3533
import 'package:pub_dev/tool/test_profile/import_source.dart';
3634
import 'package:pub_dev/tool/test_profile/importer.dart';
3735
import 'package:pub_dev/tool/test_profile/models.dart';
38-
import 'package:pub_dev/tool/utils/http_client_to_shelf_handler.dart';
3936
import 'package:pub_dev/tool/utils/pub_api_client.dart';
4037
import 'package:test/test.dart';
4138

@@ -96,9 +93,6 @@ class FakeAppengineEnv {
9693
cloudCompute: _cloudCompute,
9794
fn: () async {
9895
registerStaticFileCacheForTest(_staticFileCacheForTesting);
99-
registerSearchClient(SearchClient(
100-
httpClientToShelfHandler(handler: searchServiceHandler)));
101-
registerScopeExitCallback(searchClient.close);
10296

10397
if (testProfile != null) {
10498
await importProfile(
@@ -201,10 +195,7 @@ void testWithFakeTime(
201195
setupDebugEnvBasedLogging();
202196
await withFakeServices(
203197
fn: () async {
204-
registerStaticFileCacheForTest(StaticFileCache.forTests());
205-
registerSearchClient(SearchClient(
206-
httpClientToShelfHandler(handler: searchServiceHandler)));
207-
registerScopeExitCallback(searchClient.close);
198+
registerStaticFileCacheForTest(_staticFileCacheForTesting);
208199

209200
await importProfile(
210201
profile: testProfile ?? defaultTestProfile,

0 commit comments

Comments
 (0)