Skip to content

Commit 3707caf

Browse files
authored
Migrate the rest of the backend tests. (#2640)
* Migrate startAsyncUpload test. * Migrate finishAsyncUpload test. * Simplify test archive creation
1 parent fc2ddcc commit 3707caf

File tree

6 files changed

+146
-759
lines changed

6 files changed

+146
-759
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'package:pub_server/repository.dart';
6+
7+
import '../upload_signer_service.dart';
8+
9+
/// Returns an upload URL with no signed signature.
10+
class FakeUploadSignerService implements UploadSignerService {
11+
final String _storagePrefix;
12+
FakeUploadSignerService(this._storagePrefix);
13+
14+
@override
15+
Future<AsyncUploadInfo> buildUpload(
16+
String bucket,
17+
String object,
18+
Duration lifetime,
19+
String successRedirectUrl, {
20+
String predefinedAcl = 'project-private',
21+
int maxUploadSize = UploadSignerService.maxUploadSize,
22+
}) async {
23+
return AsyncUploadInfo(Uri.parse('$_storagePrefix/$bucket/$object'), {
24+
'key': '$bucket/$object',
25+
'success_action_redirect': successRedirectUrl,
26+
});
27+
}
28+
29+
@override
30+
Future<SigningResult> sign(List<int> bytes) async {
31+
return SigningResult('google-access-id', [1, 2, 3, 4]);
32+
}
33+
}

0 commit comments

Comments
 (0)