Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1226)

Unified Diff: utils/tests/pub/pub_uploader_test.dart

Issue 12782005: Revert "Use scheduled_test for Pub tests." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/tests/pub/pub_test.dart ('k') | utils/tests/pub/sdk_constraint_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/pub_uploader_test.dart
diff --git a/utils/tests/pub/pub_uploader_test.dart b/utils/tests/pub/pub_uploader_test.dart
index f065cf059891a5d756c4116bc7275710c8406bb8..3cbb997cced0b08fe69d84bd005eb7c20829e673 100644
--- a/utils/tests/pub/pub_uploader_test.dart
+++ b/utils/tests/pub/pub_uploader_test.dart
@@ -7,14 +7,10 @@ library pub_uploader_test;
import 'dart:io';
import 'dart:json' as json;
-import '../../../pkg/scheduled_test/lib/scheduled_process.dart';
-import '../../../pkg/scheduled_test/lib/scheduled_server.dart';
-import '../../../pkg/scheduled_test/lib/scheduled_test.dart';
-
-import '../../pub/io.dart';
-import '../../pub/utils.dart';
-import 'descriptor.dart' as d;
import 'test_pub.dart';
+import '../../../pkg/unittest/lib/unittest.dart';
+import '../../pub/utils.dart';
+import '../../pub/io.dart';
final USAGE_STRING = '''
Manage uploaders for a package on pub.dartlang.org.
@@ -54,130 +50,129 @@ main() {
integration('adds an uploader', () {
var server = new ScheduledServer();
- d.credentialsFile(server, 'access token').create();
+ credentialsFile(server, 'access token').scheduleCreate();
var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']);
- server.handle('POST', '/packages/pkg/uploaders.json', (request) {
+ server.handle('POST', '/packages/pkg/uploaders.json', (request, response) {
expect(new ByteStream(request).toBytes().then((bodyBytes) {
expect(new String.fromCharCodes(bodyBytes), equals('email=email'));
- request.response.headers.contentType =
- new ContentType("application", "json");
- request.response.write(json.stringify({
+ response.headers.contentType = new ContentType("application", "json");
+ response.write(json.stringify({
'success': {'message': 'Good job!'}
}));
- request.response.close();
+ response.close();
}), completes);
});
- expect(pub.nextLine(), completion(equals('Good job!')));
+ expectLater(pub.nextLine(), equals('Good job!'));
pub.shouldExit(0);
});
integration('removes an uploader', () {
var server = new ScheduledServer();
- d.credentialsFile(server, 'access token').create();
+ credentialsFile(server, 'access token').scheduleCreate();
var pub = startPubUploader(server, ['--package', 'pkg', 'remove', 'email']);
- server.handle('DELETE', '/packages/pkg/uploaders/email.json', (request) {
- request.response.headers.contentType =
- new ContentType("application", "json");
- request.response.write(json.stringify({
+ server.handle('DELETE', '/packages/pkg/uploaders/email.json',
+ (request, response) {
+ response.headers.contentType = new ContentType("application", "json");
+ response.write(json.stringify({
'success': {'message': 'Good job!'}
}));
- request.response.close();
+ response.close();
});
- expect(pub.nextLine(), completion(equals('Good job!')));
+ expectLater(pub.nextLine(), equals('Good job!'));
pub.shouldExit(0);
});
integration('defaults to the current package', () {
- d.validPackage.create();
+ normalPackage.scheduleCreate();
var server = new ScheduledServer();
- d.credentialsFile(server, 'access token').create();
+ credentialsFile(server, 'access token').scheduleCreate();
var pub = startPubUploader(server, ['add', 'email']);
- server.handle('POST', '/packages/test_pkg/uploaders.json', (request) {
- request.response.headers.contentType =
- new ContentType("application", "json");
- request.response.write(json.stringify({
+ server.handle('POST', '/packages/test_pkg/uploaders.json',
+ (request, response) {
+ response.headers.contentType = new ContentType("application", "json");
+ response.write(json.stringify({
'success': {'message': 'Good job!'}
}));
- request.response.close();
+ response.close();
});
- expect(pub.nextLine(), completion(equals('Good job!')));
+ expectLater(pub.nextLine(), equals('Good job!'));
pub.shouldExit(0);
});
integration('add provides an error', () {
var server = new ScheduledServer();
- d.credentialsFile(server, 'access token').create();
+ credentialsFile(server, 'access token').scheduleCreate();
var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']);
- server.handle('POST', '/packages/pkg/uploaders.json', (request) {
- request.response.statusCode = 400;
- request.response.headers.contentType =
- new ContentType("application", "json");
- request.response.write(json.stringify({
+ server.handle('POST', '/packages/pkg/uploaders.json', (request, response) {
+ response.statusCode = 400;
+ response.headers.contentType = new ContentType("application", "json");
+ response.write(json.stringify({
'error': {'message': 'Bad job!'}
}));
- request.response.close();
+ response.close();
});
- expect(pub.nextErrLine(), completion(equals('Bad job!')));
+ expectLater(pub.nextErrLine(), equals('Bad job!'));
pub.shouldExit(1);
});
integration('remove provides an error', () {
var server = new ScheduledServer();
- d.credentialsFile(server, 'access token').create();
+ credentialsFile(server, 'access token').scheduleCreate();
var pub = startPubUploader(server,
['--package', 'pkg', 'remove', 'e/mail']);
- server.handle('DELETE', '/packages/pkg/uploaders/e%2Fmail.json', (request) {
- request.response.statusCode = 400;
- request.response.headers.contentType =
- new ContentType("application", "json");
- request.response.write(json.stringify({
+ server.handle('DELETE', '/packages/pkg/uploaders/e%2Fmail.json',
+ (request, response) {
+ response.statusCode = 400;
+ response.headers.contentType = new ContentType("application", "json");
+ response.write(json.stringify({
'error': {'message': 'Bad job!'}
}));
- request.response.close();
+ response.close();
});
- expect(pub.nextErrLine(), completion(equals('Bad job!')));
+ expectLater(pub.nextErrLine(), equals('Bad job!'));
pub.shouldExit(1);
});
integration('add provides invalid JSON', () {
var server = new ScheduledServer();
- d.credentialsFile(server, 'access token').create();
+ credentialsFile(server, 'access token').scheduleCreate();
var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']);
- server.handle('POST', '/packages/pkg/uploaders.json', (request) {
- request.response.write("{not json");
- request.response.close();
+ server.handle('POST', '/packages/pkg/uploaders.json', (request, response) {
+ response.write("{not json");
+ response.close();
});
- expect(pub.nextErrLine(), completion(equals('Invalid server response:')));
- expect(pub.nextErrLine(), completion(equals('{not json')));
+ expectLater(pub.nextErrLine(), equals('Invalid server response:'));
+ expectLater(pub.nextErrLine(), equals('{not json'));
pub.shouldExit(1);
});
integration('remove provides invalid JSON', () {
var server = new ScheduledServer();
- d.credentialsFile(server, 'access token').create();
+ credentialsFile(server, 'access token').scheduleCreate();
var pub = startPubUploader(server, ['--package', 'pkg', 'remove', 'email']);
- server.handle('DELETE', '/packages/pkg/uploaders/email.json', (request) {
- request.response.write("{not json");
- request.response.close();
+ server.handle('DELETE', '/packages/pkg/uploaders/email.json',
+ (request, response) {
+ response.write("{not json");
+ response.close();
});
- expect(pub.nextErrLine(), completion(equals('Invalid server response:')));
- expect(pub.nextErrLine(), completion(equals('{not json')));
+ expectLater(pub.nextErrLine(), equals('Invalid server response:'));
+ expectLater(pub.nextErrLine(), equals('{not json'));
pub.shouldExit(1);
});
}
« no previous file with comments | « utils/tests/pub/pub_test.dart ('k') | utils/tests/pub/sdk_constraint_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698