From d31875f505aad351ca6d714196ca5fb0776b60f8 Mon Sep 17 00:00:00 2001 From: Peter Leibiger Date: Wed, 3 Mar 2021 06:00:22 +0100 Subject: [PATCH] [dart][dart-dio] Fix failing master due to unstable test dependency (#8870) * replace branch ref with commit ref (new release of http_mock_adapter coming soon) --- .../pubspec.yaml | 2 +- .../test/api/fake_api_test.dart | 6 ++-- .../test/api/pet_api_test.dart | 28 +++++++++---------- .../test/api/store_api_test.dart | 8 +++--- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.yaml index 0cc9ae782213..33a734cd0533 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.yaml @@ -13,7 +13,7 @@ dev_dependencies: http_mock_adapter: git: url: https://github.com/kuhnroyal/http-mock-adapter.git - ref: feature/response-building + ref: 2d7bb10369be49d3c53a6567cc76e8580b5d133d openapi: path: ../petstore_client_lib_fake test: 1.15.5 diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/fake_api_test.dart index c634c386e921..d0e373b7c52a 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/fake_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/fake_api_test.dart @@ -25,6 +25,7 @@ void main() { test('complete', () async { server.onPost( '/fake', + (request) => request.reply(200, null), data: { 'number': '3', 'double': '-13.57', @@ -42,7 +43,6 @@ void main() { 'content-type': 'application/x-www-form-urlencoded', 'content-length': 255, }, - handler: (response) => response.reply(200, null), ); final response = await client.getFakeApi().testEndpointParameters( @@ -65,6 +65,7 @@ void main() { test('minimal', () async { server.onPost( '/fake', + (request) => request.reply(200, null), data: { 'byte': '0', 'double': '-13.57', @@ -75,7 +76,6 @@ void main() { 'content-type': 'application/x-www-form-urlencoded', 'content-length': 79, }, - handler: (response) => response.reply(200, null), ); final response = await client.getFakeApi().testEndpointParameters( @@ -95,6 +95,7 @@ void main() { // form data in the body but some weird map server.onGet( '/fake', + (request) => request.reply(200, null), data: { 'enum_form_string': 'formString', 'enum_form_string_array': '[foo, bar]', @@ -102,7 +103,6 @@ void main() { headers: { 'content-type': 'application/x-www-form-urlencoded', }, - handler: (response) => response.reply(200, null), ); final response = await client.getFakeApi().testEnumParameters( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/pet_api_test.dart index dd5c11894d7a..616441379ba0 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/pet_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/pet_api_test.dart @@ -29,7 +29,7 @@ void main() { test('complete', () async { server.onGet( '/pet/5', - handler: (response) => response.reply(200, { + (request) => request.reply(200, { 'id': 5, 'name': 'Paula', 'status': 'sold', @@ -70,7 +70,7 @@ void main() { test('minimal', () async { server.onGet( '/pet/5', - handler: (response) => response.reply(200, { + (request) => request.reply(200, { 'id': 5, 'name': 'Paula', 'photoUrls': [], @@ -94,6 +94,7 @@ void main() { test('complete', () async { server.onPost( '/pet', + (request) => request.reply(200, ''), data: { 'id': 5, 'name': 'Paula', @@ -121,7 +122,6 @@ void main() { 'content-type': 'application/json', 'content-length': 204, }, - handler: (response) => response.reply(200, ''), ); final response = await client.getPetApi().addPet(Pet((p) => p @@ -147,6 +147,7 @@ void main() { test('minimal', () async { server.onPost( '/pet', + (request) => request.reply(200, ''), data: { 'id': 5, 'name': 'Paula', @@ -156,7 +157,6 @@ void main() { 'content-type': 'application/json', 'content-length': 38, }, - handler: (response) => response.reply(200, ''), ); final response = await client.getPetApi().addPet(Pet((p) => p @@ -171,16 +171,7 @@ void main() { test('findByStatus', () async { server.onRoute( '/pet/findByStatus', - request: Request( - method: RequestMethods.GET, - queryParameters: { - 'status': [ - 'available', - 'sold', - ], - }, - ), - handler: (response) => response.reply(200, [ + (request) => request.reply(200, [ { 'id': 5, 'name': 'Paula', @@ -194,6 +185,15 @@ void main() { 'photoUrls': [], }, ]), + request: Request( + method: RequestMethods.GET, + queryParameters: { + 'status': [ + 'available', + 'sold', + ], + }, + ), ); final response = await client.getPetApi().findPetsByStatus( diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/store_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/store_api_test.dart index f01f7a254573..0cecad29d328 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/store_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/test/api/store_api_test.dart @@ -24,14 +24,14 @@ void main() { server.onGet( '/store/inventory', - headers: { - 'api_key': 'SECRET_API_KEY', - }, - handler: (response) => response.reply(200, { + (request) => request.reply(200, { 'foo': 5, 'bar': 999, 'baz': 0, }), + headers: { + 'api_key': 'SECRET_API_KEY', + }, ); final response = await client.getStoreApi().getInventory();