forked from loafle/openapi-generator-original
* Clean up samples directory before fixing tests - removed from samples/client/petstore/dart2 : - purge_test.sh (doesn't seem to be used and not helpful) - openapi folder (is to be re-generated with more meaningful name) - updated dart2-petstore.sh to generate client library with new name - used updated shell script to re-generate client library - updated CI/.drone.yml to use the new client library for tests * Update petstore tests to use faked http client - skipped all of the tests that hit a live endpoint - made a fake http client that can be set to check for expected values and/or return a provided response - added some files with test data recorded from live api calls - updated the README to reflect changes to tests * Update .drone.yml so CI will run the tests
Background
Current state of tests
TL;DR currently the only tests are e2e tests that were adapted to use a faked http client. While pushing data around as a smoke test has some value, more testing is required. In particular we need comprehensive unit/integration tests.
- an old set of e2e tests are skipped for CI, as they hit a live endpoint and so are inherently flaky
pet_test.dart
store_test.dart
user_test.dart
- the above set of tests were adapted to use a faked http client
- the tests are not really well suited to being used with a stubbed client, many are basically just testing the endpoint logic
- while not a great set of tests, they do have some value as a smoke test for template changes
- the adapted tests and files that contain test data:
pet_test_fake_client.dart
store_test_fake_client.dart
user_test_fake_client.dart
fake_client.dart
file_upload_response.json
Assumptions
- the tests will be run as part of CI and so have access to dart:io
Running
If not already done, resolve dependencies
pub get
To run tests in a single file:
pub run test test/pet_test.dart
To run all tests in the test folder:
pub run test