| Index: pkg/http/test/multipart_test.dart
|
| diff --git a/pkg/http/test/multipart_test.dart b/pkg/http/test/multipart_test.dart
|
| index 71975311ecc77737ef9615a8b4615149b4e03250..c3c3dd9ddc9f68bd1a7add8157b96bee80c0a9d2 100644
|
| --- a/pkg/http/test/multipart_test.dart
|
| +++ b/pkg/http/test/multipart_test.dart
|
| @@ -204,18 +204,24 @@ void main() {
|
| '''));
|
| });
|
|
|
| - test('with a file from disk', () {
|
| - var tempDir = new Directory('').createTempSync();
|
| -
|
| - expect(new Future.of(() {
|
| - var filePath = path.join(tempDir.path, 'test-file');
|
| - new File(filePath).writeAsStringSync('hello');
|
| - return http.MultipartFile.fromPath('file', filePath);
|
| - }).then((file) {
|
| - var request = new http.MultipartRequest('POST', dummyUrl);
|
| - request.files.add(file);
|
| -
|
| - expect(request, bodyMatches('''
|
| + group('in a temp directory', () {
|
| + var tempDir;
|
| + setUp(() {
|
| + tempDir = new Directory('').createTempSync();
|
| + });
|
| +
|
| + tearDown(() => tempDir.deleteSync(recursive: true));
|
| +
|
| + test('with a file from disk', () {
|
| + expect(new Future.of(() {
|
| + var filePath = path.join(tempDir.path, 'test-file');
|
| + new File(filePath).writeAsStringSync('hello');
|
| + return http.MultipartFile.fromPath('file', filePath);
|
| + }).then((file) {
|
| + var request = new http.MultipartRequest('POST', dummyUrl);
|
| + request.files.add(file);
|
| +
|
| + expect(request, bodyMatches('''
|
| --{{boundary}}
|
| content-type: application/octet-stream
|
| content-disposition: form-data; name="file"; filename="test-file"
|
| @@ -223,6 +229,7 @@ void main() {
|
| hello
|
| --{{boundary}}--
|
| '''));
|
| - }).whenComplete(() => tempDir.delete(recursive: true)), completes);
|
| + }), completes);
|
| + });
|
| });
|
| }
|
|
|