protevus/test/services/users.dart

35 lines
896 B
Dart
Raw Normal View History

2016-06-23 21:54:10 +00:00
import 'dart:io';
import 'package:angel/angel.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:http/http.dart';
import 'package:test/test.dart';
main() async {
group('services.users', () {
Angel app;
Client client = new Client();
Map headers = {
HttpHeaders.ACCEPT: ContentType.JSON.mimeType,
HttpHeaders.CONTENT_TYPE: ContentType.JSON.mimeType
};
HttpServer server;
String url;
setUp(() async {
Angel app = await createServer();
server = await app.startServer(InternetAddress.LOOPBACK_IP_V4, 3000);
url = "http://localhost:3000";
});
tearDown(() async {
await server.close(force: true);
client.close();
});
test('index users', () async {
Response response = await client.get("$url/api/users");
expect(response.statusCode, equals(HttpStatus.OK));
});
});
}